hypertext transfer protocol (http)
DESCRIPTION
HyperText Transfer Protocol (HTTP). HyperText Transfer Protocol (HTTP). HTTP is the protocol that supports communication between web browsers and web servers. A “Web Server” is a HTTP server Most clients/servers today speak version 1.1, but 1.0 is also in use. RFC 1945 (HTTP 1.0) - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/1.jpg)
HyperText Transfer Protocol(HTTP)
![Page 2: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/2.jpg)
HyperText Transfer Protocol (HTTP) HTTP is the protocol that supports
communication between web browsers and web servers.
A “Web Server” is a HTTP server
Most clients/servers today speak version 1.1, but 1.0 is also in use. RFC 1945 (HTTP 1.0) RFC 2616 (HTTP 1.1)
HTTP 2
![Page 3: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/3.jpg)
From the RFC
“HTTP is an application-level protocol with the lightness and speed necessary for distributed, hypermedia information systems.”
Transport Independence The HTTP protocol generally takes place over
a TCP connection, but the protocol itself is not dependent on a
specific transport layer.
HTTP 3
![Page 4: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/4.jpg)
Request - Response
HTTP has a simple structure: client sends a request server returns a reply.
The “well known” TCP port for HTTP servers is port 80. Other ports can be used as well...
HTTP 4
![Page 5: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/5.jpg)
HTTP 1.0+ Request Lines of text (ASCII).
Lines end with CRLF “\r\n”
First line is called “Request-Line”
Request-LineHeaders...
Content...blank lineblank line
HTTP 5
![Page 6: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/6.jpg)
Request Line
Method URI HTTP-Version\r\n
The request line contains 3 tokens (words).
space characters “ “ separate the tokens.
Newline (\n) seems to work by itself but the protocol requires CRLF
HTTP 6
![Page 7: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/7.jpg)
Request Method
The Request Method can be:GET HEAD DELETE
PUT POST TRACE
OPTIONS
future expansion is supported
GET, HEAD and POST are supported everywhere (including Lab 2!).
HTTP 1.1 servers often support PUT, DELETE, OPTIONS & TRACE.
HTTP 7
![Page 8: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/8.jpg)
Methods GET: retrieve information identified by
the URI. Typically used to retrieve an HTML document
HEAD: retrieve meta-information about the URI.
used to find out if a document has changed
POST: send information to a URI and retrieve result.
used to submit a formHTTP 8
![Page 9: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/9.jpg)
More Methods PUT: Store information in location named
by URI.
DELETE: remove entity identified by URI.
TRACE: used to trace HTTP forwarding through proxies, tunnels, etc.
OPTIONS: used to determine the capabilities of the server, or characteristics of a named resource.
HTTP 9
![Page 10: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/10.jpg)
The Header Lines Request Headers provide information to
the server about the client what kind of client what kind of content will be accepted who is making the request
Each header line contains an attribute name followed by a “:” followed by
a space and the attribute value.
There can be 0 headers (HTTP 1.0) HTTP 1.1 requires a Host: header
HTTP 10
![Page 11: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/11.jpg)
Example HTTP Headers
Accept: text/html
Host: www.cse.unr.edu
From: [email protected]
User-Agent: Mozilla/4.0
Referer: http://www.unr.edu/
HTTP 11
![Page 12: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/12.jpg)
End of the Headers
Each header ends with a CRLF ( \r\n )
The end of the header section is marked with a blank line. just CRLF
For GET and HEAD requests, the end of the headers is the end of the request!
HTTP 12
![Page 13: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/13.jpg)
POST A POST request includes some content
(some data) after the headers (after the blank line).
There is no format for the data (just raw bytes).
A POST request must include a Content-Length line in the headers:
Content-length: 267
HTTP 13
![Page 14: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/14.jpg)
Example POST Request
POST /~mgunes/cpe401/grades.cgi HTTP/1.1
Accept: */*
Host: www.cse.unr.edu
User-Agent: SecretAgent V2.3
Content-Length: 35
Referer: http://www.unr.edu/
stuid=6660182722&item=test1&grade=99
HTTP 14
![Page 15: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/15.jpg)
Example GET Request
GET /~mgunes/cpe401/lab1.htm HTTP/1.1
Accept: */*
Host: www.cse.unr.edu
User-Agent: Internet Explorer
From: [email protected]
Referer: http://www.unr.edu/There is a blank line here!
HTTP 15
![Page 16: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/16.jpg)
HTTP Response
ASCII Status Line
Headers Section
Content can be anything (not just text) typically an HTML document or some kind of
image.
Status-LineHeaders...
Content...
blank lineblank line
HTTP 16
![Page 17: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/17.jpg)
Response Status Line
HTTP-Version Status-Code Message
Status Code is 3 digit number (for computers) 1xx Informational 2xx Success 3xx Redirection 4xx Client Error 5xx Server Error
Message is text (for humans)HTTP 17
![Page 18: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/18.jpg)
Example Status Lines
HTTP/1.0 200 OK
HTTP/1.0 301 Moved Permanently
HTTP/1.0 400 Bad Request
HTTP/1.0 500 Internal Server Error
HTTP 18
![Page 19: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/19.jpg)
Response Headers
Provide the client with information about the returned entity (document). what kind of document how big the document is how the document is encoded when the document was last modified
Response headers end with blank line
HTTP 19
![Page 20: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/20.jpg)
Response Header Examples
Date: Wed, 30 Jan 2002 12:48:17 EST
Server: Apache/1.17
Content-Type: text/html
Content-Length: 1756
Content-Encoding: gzip
HTTP 20
![Page 21: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/21.jpg)
Content
Content can be anything (sequence of raw bytes).
Content-Length header is required for any response that includes content.
Content-Type header also required.
HTTP 21
![Page 22: HyperText Transfer Protocol (HTTP)](https://reader036.vdocument.in/reader036/viewer/2022062721/56813861550346895da00fa8/html5/thumbnails/22.jpg)
HTTP Proxy Server
HTTPServer
Browser Proxy
HTTP 22