L3 HTTP
L3 HTTP
Transport layer
TCP, UDP, DCCP, SCTP, RSVP, ECN
Internet layer
IP (IPv4 • IPv6), ICMP, ICMPv6, IGMP, Ipsec
Link layer
ARP/InARP, NDP, OSPF, Tunnels (L2TP), PPP, Media access
control (Ethernet • DSL •ISDN • FDDI)
4
Basic Features
• HTTP is connectionless
• Client establishes a connection and closes it after a request has been made
• Server processes the request and re-establish the connection to send response to
the client
• It is a stateless protocol
• Server and client are only aware of each other only when a connection is initiated
i.e. during a current request
• After that they forget about each other
• It is media independent
• Any type of data could be sent by HTTP as long as the client and the server can
handle the data type
• Both client and server must specify the content type using appropriate MIME-type.
5
Basic Architecture
• Version
• URI
• Date/time formats
• Character sets
• Content encoding
• Media types
• Language tags
Version
• The HTTP version of an application is the highest HTTP version for which the
application is at least conditionally compliant.
HTTP/1.0 or HTTP/1.1
Date/time formats
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Example
US-ASCII
or
ISO-8859-1
Content Encoding
• A content encoding values indicate an encoding algorithm has been used to encode the
content before passing it over the network.
• Content encodings are primarily used to allow a document to be compressed or otherwise
usefully transformed without losing the identity
• HTTP/1.1 uses content-coding values in the Accept-Encoding and Content-Encoding header
fields
Example
Accept-encoding: gzip
or
Accept-encoding: compress
Media Types
• HTTP uses Internet Media Types in the Content-Type and Accept header fields in
order to provide open and extensible data typing and type negotiation.
• All the Media-type values are registered with the Internet Assigned Number
Authority (IANA).
Accept: image/gif
Language tags
Sample tags
• HTTP messages are passed in a format similar to that used by Internet mail
and the Multipurpose Internet Mail Extensions (MIME)
HTTP request and HTTP response use a generic message format consisting
of the following four items:
• A Start-line
• Zero or more header fields followed by CRLF
• An empty line (i.e., a line with nothing preceding the CRLF) indicating the end of
the header fields
• Optional message-body
HTTP Message Format
HTTP request and HTTP response use a generic message format consisting
of the following four items:
• A Start-line
• Zero or more header fields followed by CRLF
• An empty line (i.e., a line with nothing preceding the CRLF) indicating the end of
the header fields
• Optional message-body
HTTP Message Start-Line
• The headers sent by the browser notify the web server of the browser’s
capabilities.
• The headers sent by the web server tell the browser how to treat the content.
HTTP Headers Types
There are four types of HTTP message headers:
• General-header: have general applicability for both request and response messages.
Host: www.example.com
HTTP Message Body
• It is optional
• It carries the entity-body associated with the request or response
• If entity body is associated, Content-Type and Content-Length headers lines
specify the nature of the body associated.
HTTP Request
• HEAD: asks for the response identical to the one that would correspond to a GET
request, but without the response body
• POST: submits data to be processed (e.g., from an HTML form) to the identified
resource
22
HTTP Methods Contd.
• TRACE: echoes back the received request, so that a client can see what (if any)
changes or additions have been made by intermediate servers
• OPTIONS: returns the HTTP methods that the server supports for specified URL
• Accept-Charset • If-None-Match
• Accept-Encoding • If-Range
• Accept-Language • If-Unmodified-Since
• Authorization • Max-Forwards
• Expect • Proxy-Authorization
• From • Range
• Host • Referer
• If-Match • TE
• If-Modified-Since • User-Agent
Common HTTP Request (Browser) Headers
• Connection: Keep-Alive
• If-* headers
Host: localhost
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: http://localhost/400level2014-2015/forms/biodata.html
HTTP Response
Status-Line Syntax
• Age
• ETag
• Location
• Proxy-Authenticate
• Retry-After
• Server
• Vary
• WWW-Authenticate
Common HTTP Response (Server) Headers
• Connection: Keep-Alive/Close
• Content-Type:
• Date:
• Accept-Ranges: bytes
Status Codes
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
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
HTTP Response Header
(http://localhost/400level2014-2015/forms/biodata.html)
Accept-Ranges: bytes
Connection: Keep-Alive
Content-Length: 380
Content-Type: text/html
Date: Mon, 25 Jan 2016 00:34:23 GMT
Etag: "17c-50ea40e617c20"
Keep-Alive: timeout=5, max=100
Last-Modified: Mon, 09 Feb 2015 09:04:22 GMT
Server: Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9