SE452: HTTP [27/29] Previous pageContentsNext page

What is HTTP?

HTTP follows the Request-Response model

HTTP 1.1 (RFC 2616) http://www.w3.org/Protocols/

HTTPS - HTTP over SSL (Secure Socket Layer)

HTTP Requests

Request-method Request-URI HTTP-version
( Request- header ) *
blank line
[ Message-body ]
        

Request methods: GET POST PUT DELETE TRACE OPTIONS CONNECT HEAD

Request headers: key : value

GET and POST are the most common requests GET means 'get whatever information the URI points to' POST is used to tell the server to perform some action using supplied data by the request In reality, they can do the same thing, but GET query data is encoded in the URL, POST data is sent in the body of the request GET is usually used when all data can be encoded in a query string and is not part of a form POST is usually used to submit form information. We will see the difference when we look into the Servlet specification and see some examples.

HTTP Request Example

GET /index.html HTTP/1.1
Host: se.cs.depaul.edu
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.2.1) Gecko/20010901
Accept: text/xml, application/xml
Accept-Language: en-us
Accept-Encoding: gzip,deflate,compress,identity
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive

HTTP Response

HTTP-version Status-code Reason-phrase
( Response-header ) *
blank line
[ Message-body ]
        

Response headers: key : value

Content-Type: MIME Types type / subtype

HTTP Response Example

HTTP/1.1 200 OK
Date: Mon, 24 Dec 2001 14:55:07 GMT
Server: Apache/1.3.19 (Unix)  (Red-Hat/Linux)
Last-Modified: Thu, 29 Mar 2001 17:53:01 GMT
Accept-Ranges: bytes
Content-Length: 2890
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html
    

HTTP Response Example 2

HTTP/1.1 404 Not Found
Date: Mon, 24 Dec 2001 14:55:20 GMT
Server: Apache/1.3.19 (Unix)  (Red-Hat/Linux)
Keep-Alive: timeout=15, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
    

Previous pageContentsNext page