Question

I am currently developing a HTTP server.

When a client requests a PNG, my response headers are properly formatted and respond with Content-Type : image/png

What steps and encoding processes do I have to perform on my .png file to send it as a byte[] in the http response body?

Thanks!

Was it helpful?

Solution

None, unless specified by the Transfer-Encoding HTTP header.

It is all very well-documented.

OTHER TIPS

None. Just be nice and send the "Content-length" as well.

As others have said, none, HOWEVER, for extra credit your server should check if the client accepts gzip encoding (look at the 'accept-encoding' header) when sending text or xml documents (images are compressed already) and send gzip with a content-encoding header.

Also accept, accept-charset and accept-language should be respected.

All are documented in RFC2616 (HTTP 1.1)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top