HTTP Hypertext Transfer Protocol HTTP What It Is

  • Slides: 45
Download presentation
HTTP Hypertext Transfer Protocol HTTP

HTTP Hypertext Transfer Protocol HTTP

What It Is n Protocol for transfer of various data formats between server and

What It Is n Protocol for transfer of various data formats between server and client – Plaintext – Hypertext – Images – Video – Sound n HTTP Meta-information also transferred 2

Uniform Resources n URL – Uniform Resource Locator – Refers to an existing protocol

Uniform Resources n URL – Uniform Resource Locator – Refers to an existing protocol n http: , wais: , ftp: , mailto: , gopher: , news: – Points to a document on a specific server n URN – Uniform Resource Name – Globally unique, persistent identifier n HTTP Independent of location 3

Uniform Resources n URI – Uniform Resource Identifier – Collection of URL’s and URN’s

Uniform Resources n URI – Uniform Resource Identifier – Collection of URL’s and URN’s HTTP 4

URL n <scheme> : //<host> : <port> /<path> ; <parameters> ? <query> #<fragment> –

URL n <scheme> : //<host> : <port> /<path> ; <parameters> ? <query> #<fragment> – scheme n The protocol you are using – host n Host name or ip number – port n TCP port number that protocol server is using – path n HTTP Path and filename reference of object on server 5

URL n <scheme> : //<host> : <port> /<path> ; <parameters> ? <query> #<fragment> –

URL n <scheme> : //<host> : <port> /<path> ; <parameters> ? <query> #<fragment> – parameters n Any specific parameters that object needs – query n Query string for a CGI program – fragment n HTTP Reference to a subset of an object 6

URL and HTTP All parts of URL, except parameters, used with http n Scheme

URL and HTTP All parts of URL, except parameters, used with http n Scheme and host can be omitted when referenced object is on same machine as referring document n Port can be omitted so long as referenced host is running on port listed in your /etc/services file n HTTP – Usually port 80 7

URL and HTTP n Full path used when referring to another server – Relative

URL and HTTP n Full path used when referring to another server – Relative path on same server n Reference with relative path is a partial URL Query passes parameters to CGI n Fragment jumps to labels within a page n – http: //www. x. y/z#foo HTTP 8

Web Documents – html – ASCII text – Preformatted n postscript – Images GIF

Web Documents – html – ASCII text – Preformatted n postscript – Images GIF n JPEG n – Video n MPEG – VRML – Java HTTP 9

Communication n Server tells client what type of information is coming before information arrives

Communication n Server tells client what type of information is coming before information arrives – File extensions . html. htm n. txt n. ps n. au n. gif. tiff. jpeg n. mpeg n. vrml. wrl n. java n HTTP 10

Communication n Text and inline images – Separate objects Client browser may optionally send

Communication n Text and inline images – Separate objects Client browser may optionally send a list of formats it can accept n Document can be a program n HTTP – Web server executes program and sends results to client – Generic term for this program is script, gateway, or gateway script 11

Scripts Translates input from client n Calls other programs n Translates output from programs

Scripts Translates input from client n Calls other programs n Translates output from programs and returns it to client n HTTP 12

Gateways n Translates from one protocol or service to another – HTTP / database

Gateways n Translates from one protocol or service to another – HTTP / database query – Database query results / HTTP 13

HTTP 1. 0 Berners Lee, Fielding, Nielsen - 1995 n Used in hypermedia systems

HTTP 1. 0 Berners Lee, Fielding, Nielsen - 1995 n Used in hypermedia systems distributed across networks n Defines request-response conversation n – Requesting program (client) establishes connection with receiving program (server) – Client sends request to server n HTTP specifies syntax 14

HTTP 1. 0 n Defines request-response conversation – Server replies with response n n

HTTP 1. 0 n Defines request-response conversation – Server replies with response n n Does not handle network connectivity or how information is transmitted n HTTP http specifies syntax TCP/IP does this 15

HTTP 1. 0 n HTTP request – Method – URI – Protocol version –

HTTP 1. 0 n HTTP request – Method – URI – Protocol version – Optional other information – Method [Request URI] HTTP/1. 0 <CRLF> HTTP 16

HTTP 1. 0 n Method – Get n Returns object – Head n Returns

HTTP 1. 0 n Method – Get n Returns object – Head n Returns information about object – Post n HTTP Sends information to be stored on server or as input to script 17

HTTP 1. 0 n Method – Put Sends new copy of existing object to

HTTP 1. 0 n Method – Put Sends new copy of existing object to server n Usually not allowed n – Deletes object n Usually not allowed n HTTP 18

HTTP 1. 0 n Other information – User Agent n Kind of browser –

HTTP 1. 0 n Other information – User Agent n Kind of browser – If-Modified-Since Returns object only if more recent than given date n Otherwise returns status code 304 n HTTP 19

HTTP 1. 0 n Other information – Accept n Mime types which browser can

HTTP 1. 0 n Other information – Accept n Mime types which browser can accept – Multipurpose Internet Mail Extension n text/plain n text/html n application/postscript n image/gif n image/jpeg n audio/basic n video/mpeg n x-world/x-vrml HTTP 20

HTTP 1. 0 n Other information – Authorization n User password GET /X/Y/Z. HTML

HTTP 1. 0 n Other information – Authorization n User password GET /X/Y/Z. HTML HTTP 1. 0 User Agent: Prodigy-WB/1. 3 e Accept: text/plain Accept: text/html Accept: application/postscript Accept: image/gif – Accept: */* HTTP 21

HTTP 1. 0 n HTTP response – Status line HTTP-version Status-code Reason n Status-codes

HTTP 1. 0 n HTTP response – Status line HTTP-version Status-code Reason n Status-codes 1 xx - Informational n – Reserved for future use HTTP 22

HTTP 1. 0 n HTTP response – Status line n Status-codes 2 xx -

HTTP 1. 0 n HTTP response – Status line n Status-codes 2 xx - Success – The action was successfully received, understood, and accepted n 200 OK n 201 POST command successful n 202 Request accepted n 203 GET or HEAD request fulfilled n 204 No content HTTP 23

HTTP 1. 0 n HTTP response – Status line n Status-codes 3 xx -

HTTP 1. 0 n HTTP response – Status line n Status-codes 3 xx - Redirection – Further action must be taken in order to complete request n 300 Resource found at multiple locations n 301 Resource moved permanently n 302 Resource moved temporarily n 304 Resource has not modified (since date) HTTP 24

HTTP 1. 0 n HTTP response – Status line n HTTP Status-codes 4 xx

HTTP 1. 0 n HTTP response – Status line n HTTP Status-codes 4 xx - Client error – The request contains bad syntax or cannot be fulfilled n 400 Bad request from client n 401 Unauthorized request n 402 Payment required for request n 403 Resource access forbidden n 404 Resource not found n 405 Method not allowed for resource n 406 Resource type not acceptable 25

HTTP 1. 0 n HTTP response – Status line n Status-codes 5 xx -

HTTP 1. 0 n HTTP response – Status line n Status-codes 5 xx - Server error – The server failed to fulfill an apparently valid request n 500 Internal server error n 501 Method not implemented n 502 Bad gateway or server overload n 503 Service unavailable / gateway timeout n 504 Secondary gateway / server timeout HTTP 26

HTTP 1. 0 n HTTP response – Description of information Server n Date n

HTTP 1. 0 n HTTP response – Description of information Server n Date n Content-Length n Content-Type n Content-Language n Content-Encoding n Last-Modified n Expires n HTTP Type of server Date and time Number of bytes Mime type English, for example Data compression Date when last modified Date when file becomes invalid 27

HTTP 1. 0 n Problems – HTTP is stateless Each request requires separate TCP

HTTP 1. 0 n Problems – HTTP is stateless Each request requires separate TCP connection n Server doesn’t remember previous requests n HTTP 28

Evolution of HTTP n HTTP/0. 9 - 1990 – Request method + URI +

Evolution of HTTP n HTTP/0. 9 - 1990 – Request method + URI + crlf GET /pets/index. html n Just file contents sent back n – No header information n Gopher influence – Media types n HTTP Single character indicated one of ten types 29

Evolution of HTTP n HTTP/1. 0 - 1995 – Meta-information between client and server

Evolution of HTTP n HTTP/1. 0 - 1995 – Meta-information between client and server n Media types – MIME type/subtype Status codes n This information influenced the development of web search engines n – Caching – Authorization HTTP 30

Evolution of HTTP n HTTP/1. 0 - 1995 – Problems n Scalability – High

Evolution of HTTP n HTTP/1. 0 - 1995 – Problems n Scalability – High number of clients visit server for short time n Flash crowd n HTTP Bandwidth 31

Evolution of HTTP n HTTP/1. 1 – Byte ranges n Request of a document

Evolution of HTTP n HTTP/1. 1 – Byte ranges n Request of a document subset – Adobe's Portable Document Format – Streaming multimedia Eliminates unnecessary client/server communication n An interrupted transfer which is restarted can be more efficient n HTTP 32

Evolution of HTTP n HTTP/1. 1 – Content negotiation with quality factors n Quality

Evolution of HTTP n HTTP/1. 1 – Content negotiation with quality factors n Quality factors – Real numbers between 0 and 1 n Default is 1 n HTTP Accept-Language: fr, en-gb; q=0. 8, en; q=0. 7 33

Evolution of HTTP n HTTP/1. 1 – Chunked encoding n Transmission of streaming multimedia

Evolution of HTTP n HTTP/1. 1 – Chunked encoding n Transmission of streaming multimedia – One frame varies in size and composition from the next n Streaming video – Entire image transmitted in first chunk and differences to the previous image are transmitted in the next chunk HTTP 34

Evolution of HTTP n HTTP/1. 1 – Protocol switching n Client can specify another

Evolution of HTTP n HTTP/1. 1 – Protocol switching n Client can specify another protocol more suited to data being transferred – Message integrity checks – Digest authentication In HTTP/1. 0, user sent username and password over the network n In HTTP/1. 1, the client and the server never send the actual username or password over the network n HTTP 35

Evolution of HTTP n HTTP/1. 1 – Persistent connections In HTTP/1. 0, if a

Evolution of HTTP n HTTP/1. 1 – Persistent connections In HTTP/1. 0, if a single page includes inline images, multiple frames, animation, and other external references, to browse this page would require many reconnections n In HTTP/1. 1 there are multiple request/response transactions per connection n Clients can pipeline requests to the server by sending multiple requests at start of session n HTTP 36

Evolution of HTTP n HTTP/1. 1 – Cache management with entity tags n When

Evolution of HTTP n HTTP/1. 1 – Cache management with entity tags n When body of URI changes, so does its entity tag – Useful for maintaining caches, as updated URI information would have a different entity tag Can tell if same resource is being cached from multiple URI's as it would have same entity tag n Strong entity tag n – Changes when any portion of resource changes n One or more bytes change n HTTP Weak entity tag – Changes only when semantics of entity-body changes 37

Evolution of HTTP n HTTP/1. 1 – Software multihoming Number of available IP addresses

Evolution of HTTP n HTTP/1. 1 – Software multihoming Number of available IP addresses is a concern n In HTTP/1. 0, server could have multiple DNS entries and IP addresses, each corresponding to different document tree n In HTTP/1. 1, server could have multiple DNS entries and only a single IP address n HTTP 38

The Future n HTTP-Next Generation – Many channels One TCP connection carries multiple channels

The Future n HTTP-Next Generation – Many channels One TCP connection carries multiple channels for parallel communication n Different protocols on each channel n – Traditional way Multiple TCP connections between same client and server n Pages contain images, video, audio, and html n HTTP 39

The Future n Extensibility – Adding new MIME headers has been the traditional way

The Future n Extensibility – Adding new MIME headers has been the traditional way of extending http – Drawbacks No indication whether receiving end understands these extensions n No indication whether extension is intended for all parties along message path or only for certain intermediaries n No indication of order in which extensions should be interpreted n HTTP 40

The Future n Extensibility – PEP n HTTP Protocol Extension Protocol 41

The Future n Extensibility – PEP n HTTP Protocol Extension Protocol 41

The Future n Performance – Parsing MIME headers wastes resources – Sticky headers Persistent

The Future n Performance – Parsing MIME headers wastes resources – Sticky headers Persistent state between multiple http requests n Not all headers have to be included in every http message n n Distributed authoring – Event notification HTTP 42

The Future n Caching and replication – Popular sites are really popular – Flash

The Future n Caching and replication – Popular sites are really popular – Flash crowds happen – Hot spots on the net are dynamic – Amount of dynamic data is increasing HTTP 43

The Future n Qo. S – Quality of service – Not everything must be

The Future n Qo. S – Quality of service – Not everything must be treated with same Qo. S – Required Qo. S should be made at the userinterface HTTP 44

The Future n Real-time protocols and the web – Streaming protocols n HTTP Audio/video-on-demand

The Future n Real-time protocols and the web – Streaming protocols n HTTP Audio/video-on-demand 45