If you make an HTTP request to a web server, and it returns a response of type image/jpeg, how is the binary data actually encoded? Is it the original byte-level content of the image that goes across the wire, or some character-based representation of it (e.g. base64)?
Share
The encoded transfered data is specified by the
Content-EncodingHTTP response header (see HTTP 1.1 specifications in RFC2616 section 14.11 and 3.5). If present, it can be eithergzip,compress, ordeflatecompressed data (no others are defined in HTTP 1.1). If not, the data is in original encoding based on theContent-TypeHTTP response header (the MIME type). TheContent-Encodingis determined by theAccept-EncodingHTTP request header value and whether the web server support requested encoding.In your case, if the
Content-EncodingHTTP response header is absent, the data is exactly the same as the file contents. Otherwise, it’s compressed with the specified encoding. e.g.: GZip or Deflate.