Lecture # 1 By: Aftab Alam Department Of Computer Science University Of Peshawar Internet Programming
Hypertext Transfer Protocol - HTTP
Contents 1.Introduction to HTTP 2.Why is HTTP so popular ? 3.Different evolutions of HTTP HTTP 0.9, HTTP1.0 and HTTP HTTP Protocol Version HTTP 1.1 Client Request HTTP Client Request Line HTTP Client Request Header HTTP Client Request Body 4.2 HTTP 1.1 Server Response HTTP Server Response Line HTTP Server Response Header HTTP Server Response Body
Contents 1.INTRODUCTION TO HTTP 2.Why is HTTP so popular ? 3.Different evolutions of HTTP HTTP 0.9, HTTP1.0 and HTTP HTTP Protocol Version HTTP 1.1 Client Request HTTP Client Request Line HTTP Client Request Header HTTP Client Request Body 4.2 HTTP 1.1 Server Response HTTP Server Response Line HTTP Server Response Header HTTP Server Response Body
1.Introduction to HTTP HTTP stands for Hypertext Transfer Protocol. Used to transfer resources on the WWW. These resources could be HTML files Image files Query results etc
1.Introduction to HTTP (cont’d) A browser works as an HTTP client because it sends requests to an HTTP server which is called Web server. The Web Server then sends responses back to the client. The standard and default port for HTTP servers to listen on is 80.
1.Introduction to HTTP (cont’d) Three important things about HTTP. HTTP is connectionless. HTTP is media independent. (any data) HTTP is stateless.
1.Introduction to HTTP (cont’d)
Contents 1.Introduction to HTTP 2.WHY IS HTTP SO POPULAR ? 3.Different evolutions of HTTP HTTP 0.9, HTTP1.0 and HTTP HTTP Protocol Version HTTP 1.1 Client Request HTTP Client Request Line HTTP Client Request Header HTTP Client Request Body 4.2 HTTP 1.1 Server Response HTTP Server Response Line HTTP Server Response Header HTTP Server Response Body
2. Why HTTP is so popular? It is the data transfer protocol standard used for the web. HTTP is simple and fast.
Contents 1.Introduction to HTTP 2.Why is HTTP so popular ? 3.DIFFERENT EVOLUTIONS OF HTTP HTTP 0.9, HTTP1.0 and HTTP HTTP Protocol Version HTTP 1.1 Client Request HTTP Client Request Line HTTP Client Request Header HTTP Client Request Body 4.2 HTTP 1.1 Server Response HTTP Server Response Line HTTP Server Response Header HTTP Server Response Body
3.Different evolutions of HTTP. HTTP 0.9 HTTP 1.0 HTTP 1.1
3. Different evolutions of HTTP. (Cont’d) HTTP 0.9 defined in Basic features: –Request : O nly 1 method supported in the request message (GET). –Reply : Contains only HTML format. –Only HTML documents are permitted (no other formats) –Efficient and adapted when it was created but began quickly limited.
3. Different evolutions of HTTP. (Cont’d) HTTP 1.0 –Published in RFC –Improvements between these 2 versions Use the MIME type headers. Basic Authentication (no encryption). HTTP version number in the request message. Introduce metadata
3. Different evolutions of HTTP. (Cont’d) Problems with HTTP 0.9 and HTTP 1.0 –Congestion (traffic jam) and high delay during the communication. –Size of “get method” only a few thousand bit. –Not enough security (basic authentication).
3. Different evolutions of HTTP. (Cont’d) Solution HTTP 1.1 –Improve performance. –New methods : delete, put, options, trace and connect.
Contents 1.Introduction to HTTP 2.Why is HTTP so popular ? 3.Different evolutions of HTTP HTTP 0.9, HTTP1.0 and HTTP HTTP Protocol Version HTTP 1.1 Client Request HTTP Client Request Line HTTP Client Request Header HTTP Client Request Body 4.2 HTTP 1.1 Server Response HTTP Server Response Line HTTP Server Response Header HTTP Server Response Body
4. HTTP Protocol Version HTTP 1.1 Client Request 4.2. HTTP 1.1 Server Response
Contents 1.Introduction to HTTP 2.Why is HTTP so popular ? 3.Different evolutions of HTTP HTTP 0.9, HTTP1.0 and HTTP HTTP Protocol Version HTTP 1.1 Client Request HTTP Client Request Line HTTP Client Request Header HTTP Client Request Body 4.2 HTTP 1.1 Server Response HTTP Server Response Line HTTP Server Response Header HTTP Server Response Body
4. HTTP Protocol Version HTTP 1.1 Client Request The HTTP request that the browser sends to the server contains HTTP Client Request Line HTTP Client Request Header HTTP Client Request Body
4. HTTP Protocol Version HTTP 1.1 Client Request Example: GET/test.com/HTTP 1.1 Accept Language: en-us Connection: Keep-Alive Host: Referer: User-Agent: Mozilla ( Linux i586)
4. HTTP Protocol Version HTTP Client Request Line Request line consist of three pieces of information. i.HTTP command known as method oGET, POST, HEAD, PUT, DELETE, TRACE, OPTIONS, CONNECT ii.Path from the resources that the client is requesting. iii.The version numbers of HTTP (such as HTTP 1.1) Example GET/ yahoo.com HTTP/1.1
4. HTTP Protocol Version HTTP Client Request Header HTTP request’s header contains information falls into three different categories. i.General Information. Information about either client or server. ii.Entity Information. Information about the data being sent b/w client and server iii.Request Information. Request information form the client.
4. HTTP Protocol Version HTTP Client Request Header Example Accept Language: en-us Connection: Keep-Alive Host: Referer: User-Agent: Mozilla
4. HTTP Protocol Version HTTP Client Request Body If the post method is used in the HTTP request line, then the http request body contains data that is being send to the server.. For example. HTML form data.
Contents 1.Introduction to HTTP 2.Why is HTTP so popular ? 3.Different evolutions of HTTP HTTP 0.9, HTTP1.0 and HTTP HTTP Protocol Version HTTP 1.1 Client Request HTTP Client Request Line HTTP Client Request Header HTTP Client Request Body 4.2 HTTP 1.1 SERVER RESPONSE HTTP Server Response Line HTTP Server Response Header HTTP Server Response Body
4. HTTP Protocol Version HTTP 1.1 Server Response The HTTP response is sent by the server back to the client and contains the following three things HTTP Server Response Line HTTP Server Response Header HTTP Server Response Body
4. HTTP Protocol Version HTTP 1.1 Server Response Example HTTP OK (status line) Date Fri, 8Oct :09:03 GMT (General header) Server : Apache/5.0(Unix) PHP/5.0 (Response Header) Last modified Fri, 29 th Oct :09:03 GMT (Entity Header)
4. HTTP Protocol Version HTTP Server Response Line Example: HTTP/ ok Contains two bits of information. i.HTTP version number. ii.HTTP request code Request code that reports the success or failure of the request = Request is processed =Request is successful =Request failed because information has been removed =Client Error( Incomplete request or impossible request) =Server Error( the request is valid but the server is not able to complete the request)
4. HTTP Protocol Version HTTP Server Response Header Server response header consist of the following three types of information i General Information. Information about either client or server. iiEntity Information. Information about the data being sent b/w client and server iii.Response Information. Response information sending back to the client
4. HTTP Protocol Version HTTP Server Response Body If the request is successful, the HTTP response body contains the HTML code. If unsuccessful the a failure code is sent.
5. References. RFC