DOC PREVIEW
Penn CIT 597 - Hypertext Transfer Protocol Lecture

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

HTTPHTTP messagesWhat the client does, part IOther methodsWhat the client does, part IIClient request headersWhat the client does, part IIIWhat the server does, part ICommon status codesWhat the server does, part IIServer response headersWhat the server does, part IIIThe <meta http-equiv> tagSummaryThe EndHTTPHypertext Transfer ProtocolHTTP messages•HTTP is the language that web clients and web servers use to talk to each other–HTTP is largely “under the hood,” but a basic understanding can be helpful•Each message, whether a request or a response, has three parts:1. The request or the response line2. A header section3. The body of the messageWhat the client does, part I•The client sends a message to the server at a particular port (80 is the default)•The first part of the message is the request line, containing:–A method (HTTP command) such as GET or POST–A document address, and–An HTTP version number•Example:–GET /index.html HTTP/1.0Other methods•Other methods beside GET and POST are:–HEAD: Like GET, but ask that only a header be returned–PUT: Request to store the entity-body at the URI–DELETE: Request removal of data at the URI–LINK: Request header information be associated with a document on the server–UNLINK: Request to undo a LINK request–OPTIONS: Request information about communications options on the server–TRACE: Request that the entity-body be returned as received (used for debugging)What the client does, part II•The second part of a request is optional header information, such as:–What the client software is–What formats it can accept•All information is in the form Name: Value•Example: User-Agent: Mozilla/2.02Gold (WinNT; I)Accept: image/gif, image/jpeg, */*•A blank line ends the headerClient request headers•Accept: type/subtype, type/subtype, ...–Specifies media types that the client prefers to accept•Accept-Language: en, fr, de–Preferred language (For example: English, French, German) •User-Agent: string–The browser or other client program sending the request•From: [email protected]–Email address of user of client program•Cookie: name=value–Information about a cookie for that URL–Multiple cookies can be separated by commasWhat the client does, part III•The third part of a request (after the blank line) is the entity-body, which contains optional data–The entity-body part is used mostly by POST requests–The entity-body part is always empty for a GET requestWhat the server does, part I•The server response is also in three parts•The first part is the status line, which tells:–The HTTP version–A status code–A short description of what the status code means•Example: HTTP/1.1 404 Not Found•Status codes are in groups: 100-199 Informational 200-299 The request was successful 300-399 The request was redirected 400-499 The request failed 500-599 A server error occurredCommon status codes•200 OK–Everything worked, here’s the data•301 Moved Permanently–URI was moved, but here’s the new address for your records•302 Moved temporarily–URL temporarily out of service, keep the old one but use this one for now•400 Bad Request–There is a xyntax error in your request•403 Forbidden–You can’t do this, and we won’t tell you why•404 Not Found–No such document•408 Request Time-out, 504 Gateway Time-out–Request took too long to fulfill for some reasonWhat the server does, part II•The second part of the response is header information, ended by a blank line•Example:•Content-Length: 2532Connection: CloseServer: GWS/2.0Date: Sun, 01 Dec 2002 21:24:50 GMTContent-Type: text/htmlCache-control: privateSet-Cookie: PREF=ID=05302a93093ec661:TM=1038777890:LM=1038777890:S=yNWNjraftUz299RH; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.comAll on one lineThere is a nice header viewer at http://www.delorie.com/web/headers.htmlServer response headers•Server: NCSA/1.3–Name and version of the server•Content-Type: type/subtype–Should be of a type and subtype specified by the client’s Accept header•Set-Cookie: name=value; options–Requests the client to store a cookie with the given name and valueWhat the server does, part III•The third part of a server response is the entity body•This is often an HTML page–But it can also be a jpeg, a gif, plain text, etc.--anything the browser (or other client) is prepared to acceptThe <meta http-equiv> tag•The <meta http-equiv=string content=string> tag may occur in the <head> of an HTML document•http-equiv and content typically have the same kinds of values as in the HTTP header•This tag asks the client to pretend that the information actually occurred in the header–The information is not really in the header–As usual, not all browsers handle this information the same way •Example: <meta http-equiv="Set-Cookie" content="value=n;expires=date; path=url">Summary•HTTP is a fairly straightforward protocol with a lot of possible kinds of predefined header information–More kinds can be added, so long as client and server agree•A request from the client consists of three parts:1. A header line2. A block of header information, ending with a blank line3. The (optional) entity body, containing data•A response from the server consists of the same three parts•HTTP headers are “under the hood” information, not normally displayed to the user•As with most of the things covered in CIT597,–We have covered only the fundamentals–Much more detail can be found on the WebThe


View Full Document

Penn CIT 597 - Hypertext Transfer Protocol Lecture

Documents in this Course
DOM

DOM

21 pages

More DOM

More DOM

11 pages

Rails

Rails

33 pages

DOM

DOM

21 pages

RELAX NG

RELAX NG

31 pages

RELAX NG

RELAX NG

31 pages

RELAX NG

RELAX NG

31 pages

RELAX NG

RELAX NG

31 pages

Rake

Rake

12 pages

Ruby

Ruby

58 pages

DOM

DOM

21 pages

Tomcat

Tomcat

16 pages

DOM

DOM

21 pages

Servlets

Servlets

29 pages

Logging

Logging

17 pages

Html

Html

27 pages

DOM

DOM

22 pages

RELAX NG

RELAX NG

30 pages

Servlets

Servlets

28 pages

XHTML

XHTML

13 pages

DOM

DOM

21 pages

DOM

DOM

21 pages

Servlets

Servlets

26 pages

More CSS

More CSS

18 pages

Servlets

Servlets

29 pages

Logging

Logging

17 pages

Load more
Download Hypertext Transfer Protocol Lecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Hypertext Transfer Protocol Lecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Hypertext Transfer Protocol Lecture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?