Centurion
Centurion

Reputation: 14304

What is content data format of HTTP response when content-type header is image/jpeg?

Just curious, what is the content data type format of HTTP response body when content-type header is image/jpeg, binary? Was unable to see the raw content of HTTP response when viewing via Mozilla Firebug because it pops with image already.

I have never though about that too much till the talk with a guy, that told he encodes binary data into base64 format data into body of HTTP response. Are there any use cases when we need to do that?

Upvotes: 9

Views: 25774

Answers (1)

Mobile Developer
Mobile Developer

Reputation: 5760

this is what you get as repsponse header. It includes also the Content-Type: image/jpeg

HTTP/1.1 200 OK 
Last-Modified: Fri, 10 Feb 2012 14:31:06 GMT
Content-Type: image/jpeg
Content-Length: 20331
Server: WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)
Date: Fri, 10 Feb 2012 14:31:22 GMT
Connection: Keep-Alive

and the raw content data is:

......JFIF.............0Photo: Osvaldo Gago
http://www.fotografar.net....Photoshop 3.0.8BIM.......x............beach.....Algarve.....Faro..n..Osvaldo Gago..t.*Creative Commons Atribuition + Share Alike..z..Osvaldo Gago.8BIM........fotografar.net..1.Exif..II*................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................h..............................."...........................$...........,...........d....... ...l............................... .................).............
..."...........\...................................... .......... .C................... 

...................."...........D.....f...*...........................*.....(............................................... 
.. 
....'.................................................IMG:PowerShot G5 JPEG...........Firmware Version 1.00...................................
.........D...%.................@...........

Upvotes: 15

Related Questions