HTTP
Smriti Mishra
Dept. of Information Technology
Gaya College, Gaya
Paper IV Section B 1
Overview
Definition
History
HTTP 1.1 vs HTTP 1.0
HTTP Messages
Request Messages
Response Messages
Methods & Status Codes
Headers
Features
Smriti Mishra (Dept. Of IT, Gaya College) 2
Tim Berner’s Lee is the inventor
Networking Protocol
Foundation of Data Communication of www
Current Version is HTTP 2.0
It functions as request – response protocol
Default Port is 80
Underlying Protocol: TCP
Smriti Mishra (Dept. Of IT, Gaya College) 3
Application Layer, Request Response protocol
Server Response: The server reads
Basic Function & interprets the request . It takes
Client Requests: HTTP client sends action relevant to the request &
a Request message formatted creates an HTTP response
according to the rules of the HTTP message, which it sends back to the
standard – an HTTP Request. This client. Response message indicates
message specifies the resource that whether the request was successful
client wishes to retrieve or includes & may also contain the content of
information to be provided to the the resource that the client
server . requested , if appropriate.
Request
Response
HTTP Client Smriti Mishra (Dept. Of IT, Gaya College) HTTP Server 4
Client Server
• Why TCP ?
TCP split Handshake
Session Established
Smriti Mishra (Dept. Of IT, Gaya College) 5
Multiple Host support
Persistence Connections
Byte Range Request
Caching and Proxy Support
More HTTP Methods
Smriti Mishra (Dept. Of IT, Gaya College) 6
HTTP/1.1 allows an HTTP client and server to set up a
persistence connection. The TCP connection is kept open
after each request/response set, so that next
request/response can be exchanged immediately.
The session is only closed when the client is done requesting
all documents it needs.
Smriti Mishra (Dept. Of IT, Gaya College) 7
Request Messages
Response Messages
Smriti Mishra (Dept. Of IT, Gaya College) 8
All communication takes place via HTTP
messages – Request and Response
Text based
Message Format
<start line>
<message-headers>
<empty-line>
<message-body>
Smriti Mishra (Dept. Of IT, Gaya College) 9
<start line>
<message-headers>
<empty-line>
[<message-body>]
Smriti Mishra (Dept. Of IT, Gaya College) 10
<status line>
<response-headers>
<empty-line>
[<message-body>]
Smriti Mishra (Dept. Of IT, Gaya College) 11
Series of commands – for the client to
prompt the server to take action
Always in upper case
Most common types
GET
HEAD
POST
Smriti Mishra (Dept. Of IT, Gaya College) 12
Other less common methods
OPTIONS
PUT
UPDATE
DELETE
TRACE
GET, HEAD, TRACE – Safe methods
Smriti Mishra (Dept. Of IT, Gaya College) 13
HTTP Status lines contain both a numeric
status code and a text reason phrase
TTP/1.1 200 ok Status line
Status Code Reason Phrase
Smriti Mishra (Dept. Of IT, Gaya College) 14
The general form of an HTTP status code is
“xyy” , where the first digit “x” is specified as
Status Code Format Meaning
1yy Informational Message
2yy Success
3yy Redirection
4yy Client Error
5yy Server Error
Smriti Mishra (Dept. Of IT, Gaya College) 15
Browser Plug-ins
Live HTTP Headers
HTTP Fox
Browser Developer Tools
Proxy Tools
Fiddler
Charles
Burp
Wireshark and many more
Smriti Mishra (Dept. Of IT, Gaya College) 16
Used in Request Message
Allow client to provide information about itself to the server
Give details about the nature of requests
Allow the client to have greater control over how its request is processed
and how (even if) a response is returned by the server.
Examples
Accept/ Accept-charset/Accept-Encoding/Accept-language
Authorization
Expect
From
Host- the only mandatory header
Max- forwards
Proxy- Authorization etc.
Smriti Mishra (Dept. Of IT, Gaya College) 17
Appear only in HTTP responses
Provide additional that expands upon the summary information that is
present in the status line at the beginning of each server reply.
Examples
Accept-ranges
Age
Etag( specifies entity tag)
Location (using 3xx/201 status codes)
Proxy-Authenticate
Retry-After
Server
Vary
WWW Authenticate(401)
Smriti Mishra (Dept. Of IT, Gaya College) 18
Caching
Cookies
Pipelining
Smriti Mishra (Dept. Of IT, Gaya College) 19
The storing of recently-requested resources in a
temporary area
Advantages:
Reduced bandwidth used – by eliminating unneeded
tranfers of requests & responses
Faster Response Time for the user loading a resource
Can be implementing in various places:
▪ Web Client Caching
▪ Intermediary Caching
▪ Web Server Caching
Smriti Mishra (Dept. Of IT, Gaya College) 20
HTTP uses encrypted data for exchange of
communication between Client & Server.
Smriti Mishra (Dept. Of IT, Gaya College) 21