32
Lecture # 1 By: Aftab Alam Department Of Computer Science University Of Peshawar Internet Programming

Lecture # 1 By: Aftab Alam Department Of Computer Science University Of Peshawar

Embed Size (px)

DESCRIPTION

Internet Programming. Lecture # 1 By: Aftab Alam Department Of Computer Science University Of Peshawar. H ypertext T ransfer P rotocol - HTTP. Contents. Introduction to HTTP Why is HTTP so popular ? Different evolutions of HTTP. 3.1. HTTP 0.9, HTTP1.0 and HTTP 1.1 - PowerPoint PPT Presentation

Citation preview

Lecture # 1By: Aftab AlamDepartment Of Computer ScienceUniversity Of Peshawar

Internet ProgrammingInternet Programming

Hypertext Transfer Protocol - HTTPHypertext Transfer Protocol - HTTP

ContentsContents1. Introduction to HTTP

2. Why is HTTP so popular ?

3. Different evolutions of HTTP.3.1. HTTP 0.9, HTTP1.0 and HTTP 1.1

4. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request 4.1.1. HTTP Client Request Line

4.1.2. HTTP Client Request Header

4.1.3 HTTP Client Request Body

4.2 HTTP 1.1 Server Response4.2.1. HTTP Server Response Line

4.2.2. HTTP Server Response Header

4.2.3 HTTP Server Response Body

ContentsContents1. INTRODUCTION TO HTTP

2. Why is HTTP so popular ?

3. Different evolutions of HTTP.3.1. HTTP 0.9, HTTP1.0 and HTTP 1.1

4. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request 4.1.1. HTTP Client Request Line

4.1.2. HTTP Client Request Header

4.1.3 HTTP Client Request Body

4.2 HTTP 1.1 Server Response4.2.1. HTTP Server Response Line

4.2.2. HTTP Server Response Header

4.2.3 HTTP Server Response Body

1.Introduction to HTTP 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)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)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)1.Introduction to HTTP (cont’d)

ContentsContents1. Introduction to HTTP

2. WHY IS HTTP SO POPULAR ?

3. Different evolutions of HTTP.3.1. HTTP 0.9, HTTP1.0 and HTTP 1.1

4. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request 4.1.1. HTTP Client Request Line

4.1.2. HTTP Client Request Header

4.1.3 HTTP Client Request Body

4.2 HTTP 1.1 Server Response4.2.1. HTTP Server Response Line

4.2.2. HTTP Server Response Header

4.2.3 HTTP Server Response Body

2. Why HTTP is so popular?2. Why HTTP is so popular?• It is the data transfer protocol standard

used for the web.

• HTTP is simple and fast.

ContentsContents1. Introduction to HTTP

2. Why is HTTP so popular ?

3. DIFFERENT EVOLUTIONS OF HTTP.3.1. HTTP 0.9, HTTP1.0 and HTTP 1.1

4. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request 4.1.1. HTTP Client Request Line

4.1.2. HTTP Client Request Header

4.1.3 HTTP Client Request Body

4.2 HTTP 1.1 Server Response4.2.1. HTTP Server Response Line

4.2.2. HTTP Server Response Header

4.2.3 HTTP Server Response Body

3.Different evolutions of HTTP.3.Different evolutions of HTTP.

• HTTP 0.9

• HTTP 1.0

• HTTP 1.1

3. Different evolutions of HTTP. (Cont’d)3. Different evolutions of HTTP. (Cont’d)

• HTTP 0.9 defined in 1992.• Basic features:

– Request : Only 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)3. Different evolutions of HTTP. (Cont’d)

• HTTP 1.0– Published in RFC 1945.– 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)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)3. Different evolutions of HTTP. (Cont’d)

• Solution HTTP 1.1– Improve performance.

– New methods : • delete, • put, • options,• trace and • connect.

ContentsContents1. Introduction to HTTP

2. Why is HTTP so popular ?

3. Different evolutions of HTTP.3.1. HTTP 0.9, HTTP1.0 and HTTP 1.1

4. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request 4.1.1. HTTP Client Request Line

4.1.2. HTTP Client Request Header

4.1.3 HTTP Client Request Body

4.2 HTTP 1.1 Server Response4.2.1. HTTP Server Response Line

4.2.2. HTTP Server Response Header

4.2.3 HTTP Server Response Body

4. HTTP Protocol Version 1.14. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request

4.2. HTTP 1.1 Server Response

ContentsContents1. Introduction to HTTP

2. Why is HTTP so popular ?

3. Different evolutions of HTTP.3.1. HTTP 0.9, HTTP1.0 and HTTP 1.1

4. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request 4.1.1. HTTP Client Request Line

4.1.2. HTTP Client Request Header

4.1.3 HTTP Client Request Body

4.2 HTTP 1.1 Server Response4.2.1. HTTP Server Response Line

4.2.2. HTTP Server Response Header

4.2.3 HTTP Server Response Body

4. HTTP Protocol Version 1.14. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request The HTTP request that the browser sends to

the server contains

4.1.1. HTTP Client Request Line

4.1.2. HTTP Client Request Header4.1.3 HTTP Client Request Body

4. HTTP Protocol Version 1.14. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request

Example:GET/test.com/HTTP 1.1

Accept Language: en-usConnection: Keep-AliveHost: www.test.comReferer: http://test.com/index.php?id=10User-Agent: Mozilla ( Linux 2.0.32 i586)

4. HTTP Protocol Version 1.14. HTTP Protocol Version 1.1

4.1.1. HTTP Client Request LineRequest line consist of three pieces of information.

i. HTTP command known as method o GET, 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 1.14. HTTP Protocol Version 1.1

4.1.2. 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 1.14. HTTP Protocol Version 1.1

4.1.2. HTTP Client Request Header

Example

Accept Language: en-usConnection: Keep-AliveHost: www.test.comReferer: http://test.com/index.php?id=10User-Agent: Mozilla

4. HTTP Protocol Version 1.14. HTTP Protocol Version 1.1

• 4.1.3 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.

ContentsContents1. Introduction to HTTP

2. Why is HTTP so popular ?

3. Different evolutions of HTTP.3.1. HTTP 0.9, HTTP1.0 and HTTP 1.1

4. HTTP Protocol Version 1.1

4.1. HTTP 1.1 Client Request 4.1.1. HTTP Client Request Line

4.1.2. HTTP Client Request Header

4.1.3 HTTP Client Request Body

4.2 HTTP 1.1 SERVER RESPONSE4.2.1. HTTP Server Response Line

4.2.2. HTTP Server Response Header

4.2.3 HTTP Server Response Body

4. HTTP Protocol Version 1.14. HTTP Protocol Version 1.1

4.2. HTTP 1.1 Server Response

The HTTP response is sent by the server back to the client and contains the following three things.

4.1.1. HTTP Server Response Line

4.1.2. HTTP Server Response Header

4.1.3 HTTP Server Response Body

4. HTTP Protocol Version 1.14. HTTP Protocol Version 1.1

4.2. HTTP 1.1 Server Response

Example

HTTP 1.1 200 OK (status line)

Date Fri, 8Oct 3009 2009 14:09:03 GMT (General header)

Server : Apache/5.0(Unix) PHP/5.0 (Response Header)

Last modified Fri, 29th Oct 2009 14:09:03 GMT (Entity Header)

4. HTTP Protocol Version 1.14. HTTP Protocol Version 1.1

4.1.1. HTTP Server Response LineExample: HTTP/1.1 200 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.

100-199= Request is processed.

200-299=Request is successful.

300-399=Request failed because information has been removed.

400-499=Client Error( Incomplete request or impossible request)

500-599=Server Error( the request is valid but the server is not able to

complete the request)

4. HTTP Protocol Version 1.14. HTTP Protocol Version 1.1

4.1.2 HTTP Server Response HeaderServer response header consist of the following three types of information

i General Information.Information about either client or server.

ii Entity 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 1.14. HTTP Protocol Version 1.1

4.2.3 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.5. References.

RFC 2616

http://www.rfc-ditor.org/rfc/rfc2616.txt