httpgetchunked

Telnet on Linux - can i set Transfer-encoding: chunked as option of GET?


I want to get chunked response from server, but i can't understand - what wrong i did in this terminal log:

telnet www.google.com 80
Trying 172.217.20.36...
Connected to www.google.com.
Escape character is '^]'.
GET / HTTP/1.1
Transfer-Encoding: chunked

HTTP/1.1 302 Found
Location: http://www.google.com/sorry/index?continue=http://www.google.com/&q=EgRVjAHRGPGutfEFIhkA8aeDS1HQdWrbrx7jkGSfPgX8M5Ou6VMLMgFy
Date: Sun, 26 Jan 2020 09:10:10 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Content-Type: text/html; charset=UTF-8
Server: HTTP server (unknown)
Content-Length: 325
X-XSS-Protection: 0
Connection: close

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com/sorry/index?continue=http://www.google.com/&amp;q=EgRVjAHRGPGutfEFIhkA8aeDS1HQdWrbrx7jkGSfPgX8M5Ou6VMLMgFy">here</A>.
</BODY></HTML>

I choose as option:

Transfer-Encoding: chunked

But i still get Content-Length: 325, and all content is not chunked encoded. How to make GET request with chunked encoding using telnet?


Solution

  • 1) You can't force a server to use chunked encoding in the response.

    2) Setting "Transfer-Encoding" on the request means that you are sending using chunked encoding.