This example demonstrates that HTTP is a text-based Internet communications protocol, and shows a basic HTTP request and the corresponding HTTP response.
You can use Telnet to manually send a minimal HTTP request from the command line, as follows.
Start a Telnet session to the web server www.example.org
on port 80:
telnet www.example.org 80
Telnet reports that you have connected to the server:
Connected to www.example.org.
Escape character is '^]'.
Enter a request line to send a GET request URL path /
, using HTTP 1.1
GET / HTTP/1.1
Enter an HTTP header field line to identify the host name part of the required URL, which is required in HTTP 1.1
Host: www.example.org
Enter a blank line to complete the request.
The web server sends the HTTP response, which appears in the Telnet session.
The complete session, is as follows. The first line of the response is the HTTP status line, which includes the status code 200 and the status text OK, which indicate that the request was processed successfully. This is followed by a number of HTTP header fields, a blank line, and the HTML response.
$ telnet www.example.org 80
Trying 2606:2800:220:1:248:1893:25c8:1946...
Connected to www.example.org.
Escape character is '^]'.
GET / HTTP/1.1
Host: www.example.org
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=604800
Content-Type: text/html
Date: Thu, 21 Jul 2016 15:56:05 GMT
Etag: "359670651"
Expires: Thu, 28 Jul 2016 15:56:05 GMT
Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
Server: ECS (lga/1318)
Vary: Accept-Encoding
X-Cache: HIT
x-ec-custom-error: 1
Content-Length: 1270
<!doctype html>
<html>
<head>
<title>Example Domain</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div>
<h1>Example Domain</h1>
<p>This domain is established to be used for illustrative examples in documents. You may use this
domain in examples without prior coordination or asking for permission.</p>
<p><a href="http://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>
(style
element and blank lines removed from the HTML reponse, for brevity.)