开发者

The '0' in GET response. what does that mean?

开发者 https://www.devze.com 2023-01-24 11:23 出处:网络
I tried this in my ubuntu telnet client: > telnet www.google.com 80 > GET / HTTP/1.1 What I got back is a bunch of HTML li开发者_JS百科nes in the console.

I tried this in my ubuntu telnet client:

> telnet www.google.com 80
> GET / HTTP/1.1

What I got back is a bunch of HTML li开发者_JS百科nes in the console. I noticed one thing at the end of the last line, right after closing tag /Script. There is a character '0' ... what does it mean?


At the start of the response you will see:

Transfer-Encoding: chunked

1000

HTTP chunked transfer encoding means that the server doesn't know in advance how big the Content-Length of the response is going to be, so it'll give you it a bit at a time. This type of response is typical for server-side scripts, when the web server wants to start sending back script results to the user before the script has completely finished.

So the 1000 is a sign that there's a block of 4096 (0x1000) bytes to follow: <!doctype html><html><head><meta.... After 1000 bytes you get another chunk header saying (in my request) f65, meaning 3941 more bytes. After that, cc0 (3264 more bytes) and finally 0 which is a signal that the response is complete.


End of file, EOF.

0

精彩评论

暂无评论...
验证码 换一张
取 消