Hypertext Transfer Protocol HTTP - PowerPoint PPT Presentation

Loading...

PPT – Hypertext Transfer Protocol HTTP PowerPoint presentation | free to view - id: 1449f8-ZmFlZ



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Hypertext Transfer Protocol HTTP

Description:

from client: User-Agent: Mozilla/3.01Gold (X11; I; SunOS 5.5.1 sun4u) ... '203' ; Non-Authoritative. Status Code (cont'd) Status-Code = '100' ; Continue ... – PowerPoint PPT presentation

Number of Views:114
Avg rating:3.0/5.0
Slides: 18
Provided by: RaghuRamak247
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Hypertext Transfer Protocol HTTP


1
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 the requested document.
  • A document is identified by a URL (Uniform
    Resource Locator).
  • HTTP is simple and versatile
  • generic -- it can be used for various kinds of
    data.
  • object-oriented -- it supports different kinds of
    commands.
  • stateless -- the server does not need to worry
    about the state of the client.
  • For the latest information, visit
    http//www.w3.org.

2
Examples of HTTP URLs
  • http//www.engr.orst.edu
  • The server retrieves file index.html in the
    root Web directory on host www.engr.orst.edu.
  • http//www.wngr.orst.edu/minoura
  • The server retrieves file index.html in
    directory minoura/public_html on host
    www.engr.orst.edu.
  • http//flip.engr.orst.edu34567/test.html
  • The client sends a GET command to a TCP
    socket connected to port 34567.
  • http//www.engr.orst.edu/cgi-bin/cgiProg
  • The server activates program cgiProg in the
    cgi-bin directory.
  • http www.engr.orst.edu/cgi-bin/cgiwrap/minoura/t
    est.pl
  • The server activates program test.pl in
  • minoura/public_html/cgi-bin.

3
Example of HTTP Request
  • Activate TypeServer on, e.g., flip.engr.orst.edu
    as
  • java TypeServer 23456
  • server socket opened on port 23456
  • Provide URL http//flip.engr.orst.edu23456/test.h
    tml
  • to the Netscape browser.
  • Then TypeServer will produce the following
    output.
  • server connected from client
  • from client GET /test.html HTTP/1.0
  • from client Connection Keep-Alive
  • from client User-Agent Mozilla/3.01Gold
  • (X11 I SunOS 5.5.1 sun4u)
  • from client Host flip.engr.orst.edu23456
  • from client Accept image/gif, image/x-xbitmap,
  • image/jpeg, image/pjpeg, /
  • from client

4
Server Response
  • telnet www.engr.orst.edu 80
  • Trying 207.98.118.10...
  • Connected to www.engr.orst.edu.
  • Escape character is ''.
  • GET /minoura/
  • lt!-- This file was created in June 1996 --gt
  • lthtmlgt
  • ltheadgt
  • lttitlegtToshimi Minoura's Home Pagelt/titlegt
  • lt/headgt
  • ltbodygt
  • lth2gt Toshimi Minoura lt/h2gt
  • . . .
  • lthrgt
  • lt/bodygt

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

6
Head Method
  • telnet www.engr.orst.edu 80
  • Trying 207.98.118.10...
  • Connected to www.engr.orst.edu.
  • Escape character is ''.
  • HEAD /minoura/ HTTP/1.0
  • HTTP/1.0 200 Document follows
  • Date Tue, 19 Nov 1996 063947 GMT
  • Server NCSA/1.5
  • Content-type text/html
  • Last-modified Sat, 28 Sep 1996 184559 GMT
  • Content-length 4507
  • Connection closed by foreign host.

7
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
  • ltentity-body encoded as per
    Transfer-Encodinggt

8
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

9
Request Header Fields
  • Accept type/subtype
  • This field lists acceptable MIME
    content-types.
  • Accept-Language language
  • This field lists the languages preferred by
    the browser.
  • Frommail_address
  • This field contains the mail address of the
    user accessing the server.
  • If-Modified-Since date_time
  • The requested document need be sent only if
    it has been changed
  • since the indicated date and time.
  • Referer URL
  • This field gives the URL of the document
    from which the request has originated.
  • User-Agent program/version
  • This field provides information about the
    client software.

10
Response Syntax
  • Response Status-Line
  • ( general-header
  • response-header
  • entity-header )
  • CRLF
  • message-body
  • message-body entity-body
  • lt encoded entity-bodygt
  • entity-body OCTET

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

12
Status Code (contd)
  • 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

13
Example of Status Code
  • telnet www.cs.orst.edu 80
  • Trying 207.98.118.10...
  • Connected to www.cs.orst.edu.
  • Escape character is ''.
  • DELETE /hello.txt HTTP/1.0
  • HTTP/1.0 404 Not Found
  • Date Tue, 19 Nov 1996 064522 GMT
  • Server NCSA/1.5
  • Content-type text/html
  • ltHEADgtltTITLEgt404 Not Foundlt/TITLEgtlt/HEADgt
  • ltBODYgtltH1gt404 Not Foundlt/H1gt
  • The requested URL /hello.txt was not found on
    this server.
  • lt/BODYgt
  • Connection closed by foreign host.

14
Response Header and Entity Header
  • Response Header and Entity Header
  • response-header Age
  • Location
  • Proxy-Authenticate
  • Public
  • Retry-After
  • Server
  • Vary
  • Warning
  • WWW-Authenticate
  • entity-header Allow
  • Content-Base
  • Content-Encoding
  • Content-Language
  • Content-Length
  • Content-Location
  • Content-MD5
  • Content-Range

15
Accept Field
  • The Accept field in the request-header can be
    used to specify
  • acceptable media types.
  • Accept "Accept" ""
  • ( media-range accept-params
    )
  • media-range ( "/"
  • ( type "/" "" )
  • ( type "/" subtype )
  • ) ( "" parameter )
  • accept-params "" "q" "" qvalue (
    accept-extension )
  • accept-extension "" token "" ( token
    quoted-string )

16
Examples of Accept Fields
  • Accept audio/ q0.2, audio/basic
  • I prefer audio/basic. If it does not exist,
    send me any audio type after an 80 mark-down in
    quality.
  • Accept text/plain q0.5, text/html,
  • text/x-dvi q0.8, text/x-c
  • The preferred media types are text/html and
    text/x-c.
  • If they do not exist, then send the text/x-dvi
    entity.
  • If that does not exist, send the text/plain
    entity.

17
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 ot the
    text, etc.
About PowerShow.com