Table of Contents
Message Examples in HTTP: Example of Message in HTTP is easier to understand when the core ideas are paired with practical examples. The sections below explain the topic clearly, highlight useful steps, and point out details that can prevent common errors.
Example 1
HTTP requests that the hello.htm page be removed from the server running on tutorialspoint.com .
Client requires:
GET /hello.htm HTTP / 1.1 User-Agent: Mozilla / 4.0 (compatible; MSIE5.01; Windows NT) Host: www.tutorialspoint.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive
Server responds:
HTTP/1.1 200 OK Date: Mon, 27 Jul 2009 12:28:53 GMT Server: Apache/2.2.14 (Win32) Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT Content-Length: 88 Content-Type: text/html Connection: Closed
Hello, World!
Example 2
HTTP requests to remove t.html pages that do not exist on the server running on tutorialspoint.com.
Client requires:
GET / t.html HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT) Host: www.tutorialspoint.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive
Server responds:
HTTP/1.1 404 Not Found Date: Sun, 18 Oct 2012 10:36:20 GMT Server: Apache/2.2.14 (Win32) Content-Length: 230 Content-Type: text/html; charset=iso-8859-1 Connection: Closed
404 Not Found
Not Found
The requested URL /t.html was not found on this server.
Example 3
HTTP requests that the hello.htm page be removed from the server running on tutorialspoint.com but the request comes with an incorrect HTTP version:
Client requires:
GET /hello.htm HTTP1 User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT) Host: www.tutorialspoint.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive
Server responds:
HTTP/1.1 400 Bad Request Date: Sun, 18 Oct 2012 10:36:20 GMT Server: Apache/2.2.14 (Win32) Content-Length: 230 Content-Type: text/html; charset=iso-8859-1 Connection: Closed
400 Bad Request
Bad Request
Your browser sent a request that this server could not understand.
The request line contained invalid characters following the protocol string.
Example 4
HTTP requests to send sample data to process.cgi page on a server running on tutorialspoint.com . The server returns the transferred name after setting them as cookies:
Client requires:
POST /cgi-bin/process.cgi HTTP / 1.1 User-Agent: Mozilla / 4.0 (compatible; MSIE5.01; Windows NT) Host: www.tutorialspoint.com Content-Type: text / xml; charset = utf-8 Content-Length: 60 Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive first = Zara & last = Ali
Server responds:
HTTP/1.1 200 OK Date: Mon, 27 Jul 2009 12:28:53 GMT Server: Apache/2.2.14 (Win32) Content-Length: 88 Set-Cookie: first=Zara,last=Ali;domain=tutorialspoint.com;Expires=Mon, 19- Nov-2010 04:38:14 GMT;Path=/ Content-Type: text/html Connection: Closed
Hello Zara Ali
Next lesson: Installation instructions C
FAQ
What should you know about example 1?
HTTP requests that the hello.htm page be removed from the server running on tutorialspoint.com.
What should you know about client requires: GET /hello.htm HTTP / 1.1 User-Agent: Mozilla / 4.0 (compatible; MSIE5.01; Windows NT) Host: www.tutorialspoint.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive Server responds: HTTP/1.1 200 OK Date: Mon, 27 Jul 2009 12:28:53 GMT Server: Apache/2.2.14 (Win32) Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT Content-Length: 88 Content-Type: text/html Connection: Closed Hello, World! Example 2?
HTTP requests to remove t.html pages that do not exist on the server running on tutorialspoint.com.
What should you know about client requires: GET / t.html HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT) Host: www.tutorialspoint.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive Server responds: HTTP/1.1 404 Not Found Date: Sun, 18 Oct 2012 10:36:20 GMT Server: Apache/2.2.14 (Win32) Content-Length: 230 Content-Type: text/html; charset=iso-8859-1 Connection: Closed 404 Not Found Not Found The requested URL /t.html was not found on this server. Example 3?
HTTP requests that the hello.htm page be removed from the server running on tutorialspoint.com but the request comes with an incorrect HTTP version:
Reader Comments 0
Sign in with email or Google to join the discussion.