梅森响应之前和之后的这些数字意味着什么?
我在 Ubuntu 10.10 (x86) 上使用 mod_perl 2、mason 和 apache 2.2(来自 apt 的标准包)。当我向服务器发送 HTTP 请求时,我得到以下信息:
$ nc localhost 80 < ~/Desktop/test.http
HTTP/1.1 200 OK
Date: Mon, 22 Nov 2010 00:32:02 GMT
Server: Apache/2.2.16 (Ubuntu)
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/html
38
<html><body>Current IP Address: 127.0.0.1</body></html>
0
我对此有点好奇。这些数字(38 和 0)是什么意思?我查看了我的日志,但我没有看到任何有意义的东西,而且我似乎无法找出 Google 的最佳搜索短语(如果我遗漏了文档中明显的内容,我很抱歉)。我从 telnet 得到相同的结果(但 Firefox 似乎没有抛出任何类型的错误)。
这是我的请求内容(省略末尾的空格):
GET /test.html HTTP/1.1
HOST: example.com
和我的脚本(test.html):
% my $ip = $r->connection->remote_ip();
<html><body>Current IP Address: <% $ip %></body></html>
提前致谢!
I am using mod_perl 2, mason, and apache 2.2 on Ubuntu 10.10 (x86) (standard packages from apt). When I send a HTTP request to my server, I get the following:
$ nc localhost 80 < ~/Desktop/test.http
HTTP/1.1 200 OK
Date: Mon, 22 Nov 2010 00:32:02 GMT
Server: Apache/2.2.16 (Ubuntu)
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/html
38
<html><body>Current IP Address: 127.0.0.1</body></html>
0
I am a bit curious about this. What do those numbers (38 and 0) mean? I have looked in my logs, but I don't see anything meaningful and I can't seem to figure out the best search phrase for Google (and sorry if I am missing something obvious from the docs). I get the same result from telnet (but Firefox doesn't seem to throw any sort of error).
Here is the content of my request (omitting the whitespace at the end):
GET /test.html HTTP/1.1
HOST: example.com
and my script (test.html):
% my $ip = $r->connection->remote_ip();
<html><body>Current IP Address: <% $ip %></body></html>
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些数字是分块编码的边界定界符。 (请注意响应中获得的
Transfer-Encoding
标头的值。)38 表示第一个块中有 38(十六进制)= 56 字节。 0 表示没有更多的块。
The numbers are boundary delimiters for chunked encoding. (Note the value of the
Transfer-Encoding
header you got in the response.)The 38 indicates there are 38(hex) = 56 bytes in the first chunk. The 0 indicates there are no more chunks.