Using telnet to Simulate a HTTP Client: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 4: Line 4:


=Overview=
=Overview=
To close connection immediately:


<pre>
<pre>
Line 19: Line 21:
</pre>
</pre>


To keep the connection alive (with httpd as  proxy):


=Notes=
=Notes=

Revision as of 23:11, 8 January 2017

Internal

Overview

To close connection immediately:

telnet localhost 10000
GET /index.html HTTP/1.1
Host: localhost:10000
Connection: close

HTTP/1.1 200 OK
Content-Length: 37
Server: NovaOrdis http-server
Connection: close
...
Connection closed by foreign host.

To keep the connection alive (with httpd as proxy):

Notes

If we use httpd as a proxy, it'll close the connection immediately if we are not using:

Connection: Keep-Alive
Keep-Alive: timeout=3600