HTTP - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

HTTP

Description:

home=Cosby&favorite flavor=flies. The HTTP Response. Status-Line ... Time-out connection, or. Connection: close header. Host: header is required ... – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 14
Provided by: quinno
Category:
Tags: http | flies

less

Transcript and Presenter's Notes

Title: HTTP


1
HTTP
2
Introduction
  • Client-Server communication protocol
  • Request-response
  • Version 1.0
  • Stateless
  • Version 1.1 adds
  • the ability to keep connections open
  • virtual hosting
  • etc

3
Request/Response
  • General Structure
  • Start_LineltCRLFgt
  • Message HeaderltCRLFgt
  • ltCRLFgt
  • Message BodyltCRLFgt

4
More Details
  • Start_line (Request or Response)
  • Request
  • MethodltSPgtRequest-URIltSPgtHTTP-VersionltCRLFgt
  • Response
  • HTTP-VersionltSPgtStatus-codeltSPgtResponse-PhraseltCRL
    Fgt
  • Message Header
  • Field_nameltSPgtField_value, Field_value
  • Message Body
  • Binary data

5
HTTP Request Methods
  • GET Retrieve the URL
  • POST Give information to server
  • HEAD Retrieve the header for the URL
  • OPTIONS Request available options
  • PUT Store document at specified URL
  • DELETE Delete specified URL
  • and many others

6
Typical Request
  • Version 1.0
  • Version 1.1

GET /path/file.html HTTP/1.0 From
someuser_at_jmarshall.com User-Agent HTTPTool/1.0
blank line here
GET /path/file.html HTTP/1.1 Host
www.host1.com80 blank line here
7
The GET Method
  • Retrieves a URL
  • General case is very simple
  • Can send information along with URL
  • URL?name1value1name2value2
  • No Message Body

8
The POST Method
  • Send information in the Message Body
  • Information is free format

POST /path/script.cgi HTTP/1.0 From
frog_at_jmarshall.com User-Agent HTTPTool/1.0
Content-Type application/x-www-form-urlencoded
Content-Length 32 homeCosbyfavoriteflavorf
lies
9
The HTTP Response
  • Status-Line
  • HTTP-Version Status-Code Response-Phrase
  • Headers
  • Content-Type mime-type
  • Blank line
  • Message Body

10
Status Line
  • The HTTP version is in the format "HTTP/x.x".
  • The status code is meant to be computer-readable
    the reason phrase is meant to be human-readable,
    and may vary.
  • The status code is a three-digit integer
  • 1xx indicates an informational message only
  • 2xx indicates success of some kind
  • 3xx redirects the client to another URL
  • 4xx indicates an error on the client's part
  • 5xx indicates an error on the server's part

11
Some Status Codes
  • 200 OK
  • The request succeeded, and the resulting resource
    (e.g. file or script output) is returned in the
    message body
  • 404 Not Found
  • 301 Moved Permanently
  • 302 Moved Temporarily
  • 303 See Other (HTTP 1.1 only)
  • The resource has moved to another URL (given by
    the Location response header), and should be
    automatically retrieved by the client. This is
    often used by a CGI script to redirect the
    browser to an existing file.
  • 500 Server Error

12
Typical Response
HTTP/1.0 200 OK Date Fri, 31 Dec 1999 235959
GMT Content-Type text/html Content-Length
1354 lthtmlgt ltbodygt lth1gtHappy New
Millennium!lt/h1gt (more file contents) . . .
lt/bodygt lt/htmlgt
13
HTTP 1.1
  • Additional Headers
  • Sockets stay open
  • Time-out connection, or
  • Connection close header
  • Host header is required
  • Host www.servername.domain
  • Chunked Data
Write a Comment
User Comments (0)
About PowerShow.com