divinci
divinci

Reputation: 23169

What Encoding Do I Perform On Media Before Sending It In A HTTP Response Body

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!

Upvotes: 2

Views: 593

Answers (3)

SpliFF
SpliFF

Reputation: 39014

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)

Upvotes: 1

molf
molf

Reputation: 75025

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

It is all very well-documented.

Upvotes: 2

Jeff Moser
Jeff Moser

Reputation: 20053

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

Upvotes: 2

Related Questions