Presentation is loading. Please wait.

Presentation is loading. Please wait.

HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.

Similar presentations


Presentation on theme: "HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol."— Presentation transcript:

1 HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.  HTTP main property: stateless.  HTTP Request – HTTP Response.

2 HTTP2 Client Browser 1 HTTP Request PHP Module 3 4 Apache Web Server HTTP Protocol: Request and Response DB 2 5 MySQL 6 HTTP Response

3 HTTP3 HTTP Protocol: Request and Response

4 HTTP4 Hypertext Transfer Protocol (HTTP)  HTTP is an application-level protocol for document retrieval used by the World-Wide Web.  A client requests a document to be retrieved.  A server provides (responds) the requested document.  A document is identified by a URL (Uniform Resource Locator).  For the latest information, visit http://www.w3.org.

5 HTTP5 Examples of HTTP URLs  http://www.engr.orst.edu http://www.engr.orst.edu The server retrieves file index.html (or index.php) in the root Web directory on host www.engr.orst.edu.  http://classes.engr.oregonstate.edu/eecs/summer2010 /cs275/ The server retrieves file index.php in directory classes\eecs\summer2010\cs275\public_html on host classes.engr.oregonstate.edu. http://classes.engr.oregonstate.edu/eecs/summer2010 /cs275/  http://flip.engr.orst.edu:34567/test.html http://flip.engr.orst.edu:34567/test.html The client sends a request to a TCP socket connected to port 34567.

6 HTTP6 Hypertext Transfer Protocol (HTTP)  HTTP is simple and versatile:  generic -- it can be used for various kinds of data.  object-oriented -- it supports different kinds of commands (methods).  stateless -- the server does not need to remember or worry about the state of the client.

7 HTTP7 Example of HTTP Request http://classes.engr.oregonstate.edu/eecs/ summer2010/cs275/ GET /eecs/summer2010/cs275/ HTTP/1.1 Host: classes.engr.oregonstate.edu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive

8 HTTP8 Server Response HTTP/1.1 200 OK Date: Mon, 19 Jul 2010 17:15:08 GMT Server: Apache/2.2.3 (Red Hat) Set-Cookie: SESSbe80a35b84f4d2923d8e921a2f4864ef=pksdju74f0chg9j2 kci37sf457; expires=Wed, 11 Aug 2010 20:48:29 GMT; path=/; domain=.classes.engr.oregonstate.edu Expires: Sun, 19 Nov 1978 05:00:00 GMT Last-Modified: Mon, 19 Jul 2010 17:15:09 GMT Cache-Control: store, no-cache, must-revalidate, post- check=0, pre-check=0 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8

9 HTTP9 HTTP Methods  GET To retrieve the data identified by the URL.  HEAD To retrieve the header information of the entity identified by the URL.  POST To request the server to accept the data enclosed in the request.  PUT To store the enclosed data under the URL specified.  DELETE To delete the entity specified by the URL.  OPTIONS To obtain information on available communication options.

10 HTTP10 Request Syntax Request = Request-Line *( general-header | request-header | entity-header ) CRLF [ message-body ] Request-Line = Method SP Request-URI SP HTTP-Version CRLF Method = "OPTIONS" | "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "TRACE" | extension-method message-body = entity-body |

11 HTTP11 Request Header request-header = Accept | Accept-Charset | Accept-Encoding | Accept-Language | Authorization | From | Host | If-Modified-Since | If-Match | If-None-Match | If-Range | If-Unmodified-Since | Max-Forwards | Proxy-Authorization | Range | Referer | User-Agent

12 HTTP12 Response Syntax Response = Status-Line *( general-header | response-header | entity-header ) CRLF [ message-body ] message-body = entity-body |

13 HTTP13 Status Code Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF Status Code Categories 1xx -- information 2xx -- successful 3xx -- continue 4xx -- client error 5xx -- server error Status-Code = "100" ; Continue | "101" ; Switching Protocols | "200" ; OK | "201" ; Created | "202" ; Accepted | "203" ; Non-Authoritative...

14 HTTP14 Status Code (cont’d) Status-Code = "100" ; Continue... | "300" ; Multiple Choices | "301" ; Moved Permanently | " 302" ; Moved Temporarily | "400" ; Bad Request | "401" ; Unauthorized | "402" ; Payment Required | "403" ; Forbidden | "404" ; Not Found | "405" ; Method Not Allowed | "406" ; Not Acceptable | "500" ; Internal Server Error | "501" ; Not Implemented | "502" ; Bad Gateway | "503" ; Service Unavailable | "504" ; Gateway Time-out | "505" ; HTTP Version not supported

15 HTTP15 Example of Status Code http://classes.engr.oregonstate.edu/eecs/ summer2010/cs276/ GET /eecs/summer2010/cs276/ HTTP/1.1 Host: classes.engr.oregonstate.edu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 … HTTP/1.1 404 Not Found Date: Mon, 19 Jul 2010 17:21:46 GMT Server: Apache/2.2.3 (Red Hat) Content-Length: 314 Connection: close Content-Type: text/html; charset=iso-8859-1

16 HTTP16 Summary  The HTTP protocol is used to retrieve a sequence of bytes, which is often an HTML file.  It is a stateless protocol following a simple request/response paradigm.  A success or failure of the result is indicated by a status code.  It is possible to specify the properties of the document to be retrieved, for example, the encoding method of the image, the language of the text, etc.


Download ppt "HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol."

Similar presentations


Ads by Google