Top Banner
HTTP Submitted To: Er. Neha Chhabra Assistant Professor Computer Science and Engineering Department
21

HTTP

May 19, 2015

Download

Education

vaibhavrai1993

Powerpoint Presentation is all about HyperText Transfer Protocol
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: HTTP

HTTPSubmitted To:Er. Neha ChhabraAssistant ProfessorComputer Science and Engineering Department

Page 2: HTTP

HTTPHTTP stands for Hypertext Transfer Protocol. It is an

TCP/IP based communication protocol which is used to deliver virtually all files and other data, collectively called resources, on the World Wide Web. These resources could be HTML files, image files, query results, or anything else.

A browser is 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 but it can be changed to any other port like 8080 etc.

Page 3: HTTP

There are three important things about HTTP of which you should be aware: HTTP is connectionless: After a request is made, the client disconnects

from the server and waits for a response. The server must re-establish the connection after it process the request.

HTTP is media independent: Any type of data can be sent by HTTP as long as both the client and server know how to handle the data content.

HTTP is stateless: This is a direct result of HTTP's being connectionless. The server and client are aware of each other only during a request. Afterwards, each forgets the other. For this reason neither the client nor the browser can retain information between different request across the web pages.

Page 4: HTTP

Following diagram shows where HTTP Protocol fits in communication:

Page 5: HTTP

HTTP Message StructureLike most network protocols, HTTP uses the client-server

model: An HTTP client opens a connection and sends a request message to an HTTP server; the server then returns a response message, usually containing the resource that was requested. After delivering the response, the server closes the connection.

The format of the request and response messages are similar and will have following structure:

An initial line Zero or more header lines A blank line An optional message body like file, query data or query output.

Page 6: HTTP

Initial Line : Request The initial line is different for the request than for the response.

A request line has three parts, separated by spaces:An HTTP Method NameThe local path of the requested resource.The version of HTTP being used. GET is the most common HTTP method. Other methods could

be POST, HEAD etc. The path is the part of the URL after the host name. This path is

also called the request Uniform Resource Identifier (URI). A URI is like a URL, but more general.

The HTTP version always takes the form "HTTP/x.x", uppercase.

Page 7: HTTP

EXAMPLE OF Initial Line : Request

GET /path/to/file/index.html HTTP/1.0

Page 8: HTTP

Initial Line : Response

The initial response line, called the status line, also has three parts separated by spaces:

The version of HTTP being used.A response status code that gives the result of

the request.An English reason phrase describing the

status code.

Page 9: HTTP

EXAMPLE of Initial Line : Response

HTTP/1.0 200 OK or

HTTP/1.0 404 Not Found

Page 10: HTTP

Header Lines Header lines provide information about the request or response, or about

the object sent in the message body. The header lines are in the usual text header format, which is: one line per

header, of the form "Header-Name: value". It's the same format used for email and news postings.

A header line should end in. The header name is not case-sensitive. Any number of spaces or tabs may be between the ":" and the value. Header lines beginning with space or tab are actually part of the previous

header line, folded into multiple lines for easy reading.

Page 11: HTTP

EXAMPLE of Header Lines

User-agent: Mozilla/3.0Gold Or

Last-Modified: Fri, 31 Dec 1999 23:59:59 GMT

Page 12: HTTP

The Message Body An HTTP message may have a body of data sent after the header

lines. In a response, this is where the requested resource is returned to the client (the most common use of the message body), or perhaps explanatory text if there's an error. In a request, this is where user-entered data or uploaded files are sent to the server.

If an HTTP message includes a body, there are usually header lines in the message that describe the body. In particular:

The Content-Type: Header gives the MIME-type (Multi-purpose Internet Mail Extensions) of the data in the body, such as text/html or image/gif.

The Content-Length: Header gives the number of bytes in the body.

Page 13: HTTP

Request MethodsHTTP defines methods (sometimes referred to

as verbs) to indicate the desired action to be performed on the identified resource.

The HTTP/1.0 defined the GET, POST and HEAD methods and the HTTP/1.1 added 5 new methods: OPTIONS, PUT, DELETE, TRACE and CONNECT.

Page 14: HTTP

Above Methods are defined as: GET : Requests a representation of the specified resource. Requests using GET

should only retrieve data and should have no other effect. (This is also true of some other HTTP methods). The W3C has published guidance principles on this distinction, saying, "Web application design should be informed by the above principles, but also by the relevant limitations." See safe methods below.

HEAD : Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.

POST :Requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI. The data posted might be, as examples, an annotation for existing resources; a message for a bulletin board, newsgroup, mailing list, or comment thread; a block of data that is the result of submitting a web form to a data-handling process; or an item to add to a database.

Page 15: HTTP

Methods (contd.) PUT : Requests that the enclosed entity be stored under the supplied URI. If the

URI refers to an already existing resource, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI.

DELETE :Deletes the specified resource. TRACE : Echoes back the received request so that a client can see what (if any)

changes or additions have been made by intermediate servers. OPTIONS : Returns the HTTP methods that the server supports for the specified

URL. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource.

CONNECT : Converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.

PATCH : Is used to apply partial modifications to a resource. HTTP servers are required to implement at least the GET and HEAD methods

and, whenever possible, also the OPTIONS method.

Page 16: HTTP

HTTP Status Messages

Page 17: HTTP

1xx : Information

Message: Description:100 Continue Only a part of the request has been

received by the server, but as long as it has not been rejected, the client should continue with the request

101 Switching Protocols The server switches protocol

Page 18: HTTP

2xx : SuccessfulMessage: Description:

200 OK The request is OK

201 Created The request is complete, and a new resource is created 

202 Accepted The request is accepted for processing, but the processing is not complete

203 Non-authoritative Information

 

204 No Content  

205 Reset Content  

206 Partial Content  

Page 19: HTTP

5xx : Server ErrorMessage: Description:500 Internal Server Error The request was not completed. The server met

an unexpected condition501 Not Implemented The request was not completed. The server did

not support the functionality required502 Bad Gateway The request was not completed. The server

received an invalid response from the upstream server

503 Service Unavailable The request was not completed. The server is temporarily overloading or down

504 Gateway Timeout The gateway has timed out505 HTTP Version Not Supported

The server does not support the "http protocol" version

Page 20: HTTP

ANY QUERIES?

Page 21: HTTP

THANK YOU

An Effort By :-VAIBHAV RAI6312077