HTTP
•HTTP
stands for Hypertext
Transfer Protocol.
It is an TCP/IP based communication protocol which is used to deliver virtually
all files and other data, collectively called resources, on the World Wide Web.
These resources could be HTML files, image files, query results, or anything
else.
An
HTTP conversation
HTTP
is the set of rules governing the format and content of the conversation
between a Web client and server.
HTTP
Message
• HTTP
uses the client-server model: An HTTP client opens a connection and sends a
request message to an HTTP server; the server then returns a response message,
usually containing the resource that was requested. After delivering the
response, the server closes the connection.
HTTP transaction
HTTP
Message
The
format of the request and response messages are similar and will have following
structure
- An initial line
- Zero or more header lines
- A blank line
- An optional message body like file, query
data or query output.
HTTP
Methods
- GET
- POST
- HEAD
•GET (default) and POST do basically the same thing: Send data from the client to the server.
However, they have some differences:
•GET
–Appends form data directly to the end of the UR— visible to users
(not suitable for sending passwords)
–Limited to 2,048 characters for the entire URL
–Result page can be bookmarked and cached
•POST
–Sends form data in the HTTP request—invisible to users
–Virtually no limit (but check your specific configuration)
–Results are not cacheable or bookmarkable
The
HEAD Method
A HEAD request is just like a GET request, except it asks the server to return the response headers only, and not the actual resource (i.e. no message body). This is useful to check characteristics of a resource without actually downloading it, thus saving bandwidth. Use HEAD when you don't actually need a file's contents.
A HEAD request is just like a GET request, except it asks the server to return the response headers only, and not the actual resource (i.e. no message body). This is useful to check characteristics of a resource without actually downloading it, thus saving bandwidth. Use HEAD when you don't actually need a file's contents.
The response to a HEAD request must never
contain a message body, just the status line and headers.
HTTP
Header Fields
•Allow
•Authorization
•Content-Encoding
•Content-Length
•Content-Type
•Date
•User-Agent
•Referer
•Server
HTTP
Status Codes
Example
of an HTTP Request from a Web browser
HTTP version 1.1 specifies a persistent connection by default.
scenario
in which an electronic store can benefit from the use of cookies. Assume a
shopper wants to buy a toy from an electronic store named BestToys. The
shopper browser (client) sends a request to the BestToys
server.