Using telnet to Simulate a HTTP Client: Difference between revisions
Jump to navigation
Jump to search
(10 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
=Overview= | =Overview= | ||
To close connection immediately: | |||
<pre> | <pre> | ||
telnet localhost 10000 | telnet localhost 10000 | ||
GET /index.html HTTP/1.1 | GET /index.html HTTP/1.1 | ||
Host: localhost:10000 | |||
Connection: close | Connection: close | ||
Line 16: | Line 19: | ||
... | ... | ||
Connection closed by foreign host. | Connection closed by foreign host. | ||
</pre> | |||
To keep the connection alive (with httpd as proxy), instead of "Connection: close" send: | |||
<pre> | |||
Connection: Keep-Alive | |||
</pre> | |||
httpd will react to that if [[Httpd_KeepAlive#KeepAlive|KeepAlive]] is "On", and will keep the connection alive for [[Httpd_KeepAliveTimeout#KeepAliveTimeout|KeepAliveTimeout]] seconds. |
Latest revision as of 23:17, 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), instead of "Connection: close" send:
Connection: Keep-Alive
httpd will react to that if KeepAlive is "On", and will keep the connection alive for KeepAliveTimeout seconds.