Hypertext Transfer Protocol Kyle Roth Mark Hoover
What is HTTP ● Protocol – Mainly used for accessing data on the World Wide Web. – Similar to FTP and SMTP ● HTTP and FTP transfer files and use services of TCP ● HTTP only uses one TCP connection. ● HTTP and SMTP messages look similar ● HTTP messages are only interpreted by the browser – HTTP typically uses TCP, but only presumes reliable transport – HTTP uses a request/response model
Request/Response
World Wide Web ● The Wold Wide Web is a distributed client/server service ● HTTP provides uniformity over requests and responses ● HTTP requests are requests for Web Documents ● HTTP responses are Web Documents
HTTP Messages ● There are two types of HTTP messages ● Request Message – Request Line – Header – Body ● Response Message – Status Line – Header – Body
HTTP Message
Request Line and Status Line ● Request Line – Request Type – URL – HTTP Version ● Status Line – HTTP Version – Status Code – Status phrase
Request Type ● The Request type defines the type of action that the client is requesting ● GET – Requests a document from the server ● HEAD – Requests information about a document, but not the document itself ● POST – Sends some information from client to server ● PUT – Sends a document from client to server ● TRACE – Echoes the incoming request ● CONNECT – Reserved ● OPTION – Inquires about available options
URL ● Standard for specifying any kind of information on the Internet ● Defines – Protocol – HTTP – Host – Referred to by an alias (typically www) – Port – Specifies port number of the server (optional) – Path – Pathname to the file
Status Code/Phrase ● The Status code reports the success of the request – 100 Range – Informational – 200 Range – Successful request – 300 Range – Redirection – 400 Range – Client Side Error – 500 Range – Server Side Error
Status Codes
HTTP Header ● Header contains additional information ● The header can specify format constraints ● Four categories of headers – General – Information about the message – Request – Specifies client's configuration and preferred format – Response – Specifies server's configuration and special information about the request – Entity – Information about the body
General Header
Request Header
Response
Entity
HTTP Transaction
Nonpersistent Connections ● Persistent connections are default in HTTP version 1.1 ● One connection is made for each request/response – Client opes a connection and sends a request – Server sends the response and closes the connection – Client reads data, then closes the connection ● Requires N connections for N files
Persistent Connections ● Persistent connections remove the high overhead of non persistent connections ● The connection remains open until the client requests it to be closed, or the connection times out ● Length of data is sent when applicable
Proxy Servers ● Proxy servers act as go betweens for the actual servers ● Proxy servers maintain a cache of recent requests ● HTTP requests are sent to proxy servers, which check their cache ● The actual server is only accessed when the proxy server does not have the requested information – The proxy server polls the server for the requested information and updates its cache
Proxy Servers ● This reduces traffic coming into the original server. – Latency is improved ● Requires that the client is configured to access the proxy instead of the target server