当内容类型标头为 image/jpeg 时,HTTP 响应的内容数据格式是什么?

发布于 2025-01-04 21:52:12 字数 200 浏览 1 评论 0原文

只是好奇,当内容类型标头为 image/jpeg、二进制时,HTTP 响应正文的内容数据类型格式是什么?通过 Mozilla Firebug 查看时无法看到 HTTP 响应的原始内容,因为它已经随图像一起弹出。

我从来没有想过太多这个问题,直到与一个人交谈,他告诉我他将二进制数据编码为 Base64 格式数据到 HTTP 响应正文中。当我们需要这样做时,有什么用例吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

国产ˉ祖宗 2025-01-11 21:52:13

这就是您得到的响应标头。它还包括内容类型: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

,原始内容数据为:

......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...%.................@...........

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...%.................@...........
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文