Presentation is loading. Please wait.

Presentation is loading. Please wait.

HTTP Protocol Amanda Burrows. HTTP Protocol The HTTP protocol is used to send HTML documents through the Internet. The HTTP protocol sends the HTML documents.

Similar presentations


Presentation on theme: "HTTP Protocol Amanda Burrows. HTTP Protocol The HTTP protocol is used to send HTML documents through the Internet. The HTTP protocol sends the HTML documents."— Presentation transcript:

1 HTTP Protocol Amanda Burrows

2 HTTP Protocol The HTTP protocol is used to send HTML documents through the Internet. The HTTP protocol sends the HTML documents in packets, using TCP/IP. With each packet, the HTTP protocol attaches a header, which contains information such as the name and location of the page being requested, the name and IP address of the remote server that contains the Web page, the IP address of the local client, the HTTP version number, and the URL of the referring page. This information is referred to as the server variables. The HTTP protocol is used to send HTML documents through the Internet. The HTTP protocol sends the HTML documents in packets, using TCP/IP. With each packet, the HTTP protocol attaches a header, which contains information such as the name and location of the page being requested, the name and IP address of the remote server that contains the Web page, the IP address of the local client, the HTTP version number, and the URL of the referring page. This information is referred to as the server variables.

3 Information The Hypertext Transfer Protocol (HTTP) is an application-level protocol with the lightness and speed necessary for distributed, collaborative, hypermedia information systems. HTTP has been in use by the World-Wide Web global information initiative since 1990. The Hypertext Transfer Protocol (HTTP) is an application-level protocol with the lightness and speed necessary for distributed, collaborative, hypermedia information systems. HTTP has been in use by the World-Wide Web global information initiative since 1990. HTTP version 1.0 is a stateless protocol HTTP version 1.0 is a stateless protocol HTTP 1.1 is stateful HTTP 1.1 is stateful

4 Improvements in HTTP 1.1 Requests include a Host MIME header so that one web server can easily serve different sites at different URLs. Requests include a Host MIME header so that one web server can easily serve different sites at different URLs. Servers and browsers can exchange compressed files and particular byte ranges of a document, both of which can decrease network traffic. Servers and browsers can exchange compressed files and particular byte ranges of a document, both of which can decrease network traffic. HTTP 1.1 is designed to work much better with proxy servers HTTP 1.1 is designed to work much better with proxy servers HTTP 1.1 is a strict superset of HTTP 1.0, so HTTP 1.1 web servers have no trouble interacting with older browsers that speak only HTTP 1.0 HTTP 1.1 is a strict superset of HTTP 1.0, so HTTP 1.1 web servers have no trouble interacting with older browsers that speak only HTTP 1.0

5 HTTP HTTP, the Hypertext Transfer Protocol, is the standard protocol for communication between web browsers and web servers. HTTP specifies how a client and server establish a connection, how the client requests data from the server, how the server responds to that request, and finally how the connection is closed. HTTP connections use the TCP/IP protocol for data transfer. HTTP, the Hypertext Transfer Protocol, is the standard protocol for communication between web browsers and web servers. HTTP specifies how a client and server establish a connection, how the client requests data from the server, how the server responds to that request, and finally how the connection is closed. HTTP connections use the TCP/IP protocol for data transfer.

6 Step 1 HTTP 1.0 is the currently accepted version of the protocol. It uses MIME to encode data. The basic protocol defines a sequence of four steps for each request from a client to the server: HTTP 1.0 is the currently accepted version of the protocol. It uses MIME to encode data. The basic protocol defines a sequence of four steps for each request from a client to the server: Making the connection. The client establishes a TCP connection to the server, on port 80 by default; other ports may be specified in the URL. Making the connection. The client establishes a TCP connection to the server, on port 80 by default; other ports may be specified in the URL.

7 Step 2 Making a request. The client sends a message to the server requesting the page at a specified URL. The format of this request is typically something like: Making a request. The client sends a message to the server requesting the page at a specified URL. The format of this request is typically something like: GET /index.html HTTP 1.0 GET /index.html HTTP 1.0

8 Request-Line The Request-Line begins with a method token, followed by the Request-URI and the protocol version, and ending with CRLF. The elements are separated by SP characters. No CR or LF are allowed except in the final CRLF sequence. The Request-Line begins with a method token, followed by the Request-URI and the protocol version, and ending with CRLF. The elements are separated by SP characters. No CR or LF are allowed except in the final CRLF sequence. Request-Line = Method SP Request-URI SP HTTP-Version CRLF * Note that the difference between a Simple-Request and the Request-Line of a Full-Request is the presence of the HTTP- Version field and the availability of methods other than GET. * Note that the difference between a Simple-Request and the Request-Line of a Full-Request is the presence of the HTTP- Version field and the availability of methods other than GET.

9 Method The Method token indicates the method to be performed on the resource identified by the Request-URI. The method is case- sensitive. The Method token indicates the method to be performed on the resource identified by the Request-URI. The method is case- sensitive. Method = "GET" ; | "HEAD" ; | "HEAD" ; | "POST" ; | "POST" ; | extension-method | extension-method extension-method = token The list of methods acceptable by a specific resource can change dynamically; the client is notified through the return code of the response if a method is not allowed on a resource. Servers should return the status code 501 (not implemented) if the method is unrecognized or not implemented. The list of methods acceptable by a specific resource can change dynamically; the client is notified through the return code of the response if a method is not allowed on a resource. Servers should return the status code 501 (not implemented) if the method is unrecognized or not implemented.

10 GET The GET method means retrieve whatever information is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process. The GET method means retrieve whatever information is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process. The semantics of the GET method changes to a "conditional GET" if the request message includes an If-Modified-Since header field. A conditional GET method requests that the identified resource be transferred only if it has been modified since the date given by the If-Modified-Since header. The semantics of the GET method changes to a "conditional GET" if the request message includes an If-Modified-Since header field. A conditional GET method requests that the identified resource be transferred only if it has been modified since the date given by the If-Modified-Since header. The conditional GET method is intended to reduce network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring unnecessary data. The conditional GET method is intended to reduce network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring unnecessary data.

11 Head The HEAD method is identical to GET except that the server must not return any Entity-Body in the response. The metainformation contained in the HTTP headers in response to a HEAD request should be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the resource identified by the Request-URI without transferring the Entity-Body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification. The HEAD method is identical to GET except that the server must not return any Entity-Body in the response. The metainformation contained in the HTTP headers in response to a HEAD request should be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the resource identified by the Request-URI without transferring the Entity-Body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification. There is no "conditional HEAD" request analogous to the conditional GET. If an If-Modified-Since header field is included with a HEAD request, it should be ignored. There is no "conditional HEAD" request analogous to the conditional GET. If an If-Modified-Since header field is included with a HEAD request, it should be ignored.

12 Post The POST method is used to request that the destination server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions: The POST method is used to request that the destination server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions: Annotation of existing resources; Annotation of existing resources; Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; Providing a block of data, such as the result of submitting a form, to a data-handling process; Providing a block of data, such as the result of submitting a form, to a data-handling process; Extending a database through an append operation. Extending a database through an append operation.

13 Step 3 The response. The server sends a response to the client. The response begins with a response code, followed by MIME header information, then a blank line, then the requested document or an error message. Assuming the requested file is found, a typical response looks like this: The response. The server sends a response to the client. The response begins with a response code, followed by MIME header information, then a blank line, then the requested document or an error message. Assuming the requested file is found, a typical response looks like this:

14 Step 3 (cont) HTTP 1.0 200 OK Server: NCSA/1.4.2 MIME-version: 1.0 Content-type: text/html Content-length: 107 <html><Head><Title> A Sample HTML file </Title></Head><body> The rest of the document goes here </body></html>

15 Step 4 Closing the connection. Either client or the server or both close the connection. Thus, a separate network connection is used for each request. If the client reconnects, the server retains no memory of past requests is called stateless; in contrast, a stateful protocol such as FTP can process many requests before the connection is closed. The lack of state is both a strength and a weakness of HTTP. Closing the connection. Either client or the server or both close the connection. Thus, a separate network connection is used for each request. If the client reconnects, the server retains no memory of past requests is called stateless; in contrast, a stateful protocol such as FTP can process many requests before the connection is closed. The lack of state is both a strength and a weakness of HTTP.

16 Example of connections… Imagine that you are browsing a Web page and have just clicked on a link whose URL is http://www.cob.mnsu.edu/faculty.html. The following sequence of events will take place to let you access that page: Imagine that you are browsing a Web page and have just clicked on a link whose URL is http://www.cob.mnsu.edu/faculty.html. The following sequence of events will take place to let you access that page:http://www.cob.mnsu.edu/faculty.html Your Web browser will determine the URL associated with the link and will extract the name of the machine to which it must connect – in this case, www.cob.mnsu.edu. Your Web browser will determine the URL associated with the link and will extract the name of the machine to which it must connect – in this case, www.cob.mnsu.edu. www.cob.mnsu.edu The browser will use the TCP/IP protocols to establish a connection across the Internet between your computer and www.cob.mnsu.edu. The browser will use the TCP/IP protocols to establish a connection across the Internet between your computer and www.cob.mnsu.edu.www.cob.mnsu.edu When the connection between these two machines has been established, your browser will send a special HTTP message called GET, which indicates that it wants the destination machine to retrieve a page. The GET command contains the name of the desired page, in this case “faculty.html.” When the connection between these two machines has been established, your browser will send a special HTTP message called GET, which indicates that it wants the destination machine to retrieve a page. The GET command contains the name of the desired page, in this case “faculty.html.” The remote machine www.cob.mnsu.edu locates the file name in the GET message, reads it, copies it, and returns the copy to your browser, again using TCP/IP and the Internet. The remote machine www.cob.mnsu.edu locates the file name in the GET message, reads it, copies it, and returns the copy to your browser, again using TCP/IP and the Internet.www.cob.mnsu.edu Your browser receives the page and displays its contents on your screen. Your browser receives the page and displays its contents on your screen.

17 Multipurpose Internet Mail Extensions MIME is an open standard for sending multipart, multimedia data through Internet email. MIME is an open standard for sending multipart, multimedia data through Internet email. Originally intended for email Originally intended for email Content types are classified at two levels: a type and a subtype Content types are classified at two levels: a type and a subtype

18 HTTP communication Most HTTP communication is initiated by a user agent and consists of a request to be applied to a resource on some original server. Most HTTP communication is initiated by a user agent and consists of a request to be applied to a resource on some original server. A more complicated situation occurs when one or more intermediaries are present in the request/response chain. A more complicated situation occurs when one or more intermediaries are present in the request/response chain.

19 Three common forms: Proxy – is a forwarding agend, receiving requests for a URI in its absolute form, rewriting all or parts of the message, and forwarding the reformatted request toward the server identified by the URI Proxy – is a forwarding agend, receiving requests for a URI in its absolute form, rewriting all or parts of the message, and forwarding the reformatted request toward the server identified by the URI Gateway – is a receiving agent, acting as a layer above some other server and, if necessary, translating the requests to the underlying server’s protocol Gateway – is a receiving agent, acting as a layer above some other server and, if necessary, translating the requests to the underlying server’s protocol Tunnel – acts as a relay point between two connections without changing the messages Tunnel – acts as a relay point between two connections without changing the messages

20 Any Questions??


Download ppt "HTTP Protocol Amanda Burrows. HTTP Protocol The HTTP protocol is used to send HTML documents through the Internet. The HTTP protocol sends the HTML documents."

Similar presentations


Ads by Google