W3C home > Mailing lists > Public > www-talk@w3.org > January to February 2003

Re: How does a web server sends an image? Need help...

From: Ian Clelland <ian@veryfresh.com>
Date: Tue, 18 Feb 2003 12:07:41 -0800
To: znaidi reda <znaidi_reda@hotmail.com>
Cc: www-talk@w3.org
Message-ID: <20030218200741.GB16273@fullfactor.com>

On Tue, Feb 18, 2003 at 06:07:31PM +0100, znaidi reda wrote:
> Hello everybody,
> I've a piece of code which does the same thing as an usual web
> server, except that it doesn't work correctly...
> well I tried to send an image but the result on the browser is too
> ugly....
> the header sent is like this :
> HTTP/1.1 200 OK \n
> Date : Wed, 22 Oct 1997 21:00:00 GMT\n
> Server : MyServeur/1.0 \n
> Content-Type : image/gif\n
> Content-Length : 5 \n
> Last-Modified: Tue, 08 Jul 1997 00:00:00 GMT \n \n
> then I send the image which is a table of BYTES read on a
> file...(the mistake is maybe here)....
> I verify that everything is sent correctly...the problem is that the
> browser doesn't know how to display the image and i don't know how to
> tell him how to do so....
> by the way, html files are displaye correctly...and i have the same
> problems with .doc for example...
> if anyone interested by code i'll be glad....
> can someone give a help : what does miss in the header or in
> somewhere?
> Reda.

Your headers seem to be valid HTTP, and you have included all of the
necessary headers.

Is your image file really only 5 bytes long? If it is longer than this,
then the web browser may be ignoring everything after the first five
bytes (even if you are sending the whole file,) and you will end up with
a broken image.

If you are using a Unix system, you may want to try a tool like tcpdump,
to see exactly what bytes are being sent over the network.

Hope this helps,
Ian Clelland
Received on Tuesday, 18 February 2003 15:07:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:04 UTC