Upload
alison-rusten
View
237
Download
5
Embed Size (px)
Citation preview
HTTPHTTP
Hypertext Transfer Hypertext Transfer ProtocolProtocol
HTTP 2
What It IsWhat It Is
Protocol for transfer of various data Protocol for transfer of various data formats between server and clientformats between server and client– PlaintextPlaintext– HypertextHypertext– ImagesImages– VideoVideo– SoundSound
Meta-information also transferredMeta-information also transferred
HTTP 3
Uniform ResourcesUniform Resources
URLURL– Uniform Resource LocatorUniform Resource Locator– Refers to an existing protocolRefers to an existing protocol
http:, wais:, ftp:, mailto:, gopher:, news:http:, wais:, ftp:, mailto:, gopher:, news:
– Points to a document on a specific serverPoints to a document on a specific server URNURN
– Uniform Resource NameUniform Resource Name– Globally unique, persistent identifierGlobally unique, persistent identifier
Independent of locationIndependent of location
HTTP 4
Uniform ResourcesUniform Resources
URIURI– Uniform Resource IdentifierUniform Resource Identifier– Collection of URL’s and URN’sCollection of URL’s and URN’s
HTTP 5
URLURL <scheme> : //<host> :<port> /<path> <scheme> : //<host> :<port> /<path>
;<parameters> ?<query> ;<parameters> ?<query> #<fragment>#<fragment>– schemescheme
The protocol you are usingThe protocol you are using– hosthost
Host name or ip numberHost name or ip number– portport
TCP port number that protocol server is usingTCP port number that protocol server is using– pathpath
Path and filename reference of object on serverPath and filename reference of object on server
HTTP 6
URLURL
<scheme> : //<host> :<port> <scheme> : //<host> :<port> /<path> ;<parameters> ?/<path> ;<parameters> ?<query> #<fragment><query> #<fragment>– parametersparameters
Any specific parameters that object Any specific parameters that object needsneeds
– queryquery Query string for a CGI programQuery string for a CGI program
– fragmentfragment Reference to a subset of an objectReference to a subset of an object
HTTP 7
URL and HTTPURL and HTTP
All parts of URL, except parameters, All parts of URL, except parameters, used with httpused with http
Scheme and host can be omitted Scheme and host can be omitted when referenced object is on same when referenced object is on same machine as referring documentmachine as referring document
Port can be omitted so long as Port can be omitted so long as referenced host is running on port referenced host is running on port listed in your /etc/services filelisted in your /etc/services file– Usually port 80Usually port 80
HTTP 8
URL and HTTPURL and HTTP
Full path used when referring to Full path used when referring to another serveranother server– Relative path on same serverRelative path on same server
Reference with relative path is a Reference with relative path is a partialpartial URLURL
Query passes parameters to CGIQuery passes parameters to CGI Fragment jumps to labels within a Fragment jumps to labels within a
pagepage– http://www.x.y/z#foohttp://www.x.y/z#foo
HTTP 9
Web DocumentsWeb Documents
– htmlhtml– ASCII textASCII text– PreformattedPreformatted
postscriptpostscript– ImagesImages
GIFGIF JPEGJPEG
– VideoVideo MPEGMPEG
– VRMLVRML– JavaJava
HTTP 10
CommunicationCommunication Server tells client what type of Server tells client what type of
information is coming before information is coming before information arrivesinformation arrives– File extensionsFile extensions
.html .htm.html .htm .txt.txt .ps.ps .au.au .gif .tiff .jpeg.gif .tiff .jpeg .mpeg.mpeg .vrml .wrl.vrml .wrl .java.java
HTTP 11
CommunicationCommunication
Text and inline imagesText and inline images– Separate objectsSeparate objects
Client browser may optionally send a Client browser may optionally send a list of formats it can acceptlist of formats it can accept
Document can be a programDocument can be a program– Web server executes program and sends Web server executes program and sends
results to clientresults to client– Generic term for this program is Generic term for this program is scriptscript, ,
gatewaygateway, or , or gateway scriptgateway script
HTTP 12
ScriptsScripts
Translates input from clientTranslates input from client Calls other programsCalls other programs Translates output from programs Translates output from programs
and returns it to clientand returns it to client
HTTP 13
GatewaysGateways
Translates from one protocol or Translates from one protocol or service to anotherservice to another– HTTP / database queryHTTP / database query– Database query results / HTTPDatabase query results / HTTP
HTTP 14
HTTP 1.0HTTP 1.0
Berners Lee, Fielding, Nielsen - 1995Berners Lee, Fielding, Nielsen - 1995 Used in hypermedia systems Used in hypermedia systems
distributed across networksdistributed across networks Defines request-response Defines request-response
conversationconversation– Requesting program (client) establishes Requesting program (client) establishes
connection with receiving program connection with receiving program (server)(server)
– Client sends request to serverClient sends request to server HTTP specifies syntaxHTTP specifies syntax
HTTP 15
HTTP 1.0HTTP 1.0
Defines request-response Defines request-response conversationconversation– Server replies with responseServer replies with response
http specifies syntaxhttp specifies syntax
Does not handle network Does not handle network connectivity or how information is connectivity or how information is transmittedtransmitted
TCP/IP does thisTCP/IP does this
HTTP 16
HTTP 1.0HTTP 1.0
HTTP requestHTTP request– MethodMethod– URIURI– Protocol versionProtocol version– Optional other informationOptional other information– Method [Request URI] HTTP/1.0 Method [Request URI] HTTP/1.0
<CRLF><CRLF>
HTTP 17
HTTP 1.0HTTP 1.0
MethodMethod– GetGet
Returns objectReturns object
– HeadHead Returns information about objectReturns information about object
– PostPost Sends information to be stored on server Sends information to be stored on server
or as input to scriptor as input to script
HTTP 18
HTTP 1.0HTTP 1.0
MethodMethod– PutPut
Sends new copy of existing object to Sends new copy of existing object to serverserver
Usually not allowedUsually not allowed
– DeleteDelete Deletes objectDeletes object Usually not allowedUsually not allowed
HTTP 19
HTTP 1.0HTTP 1.0
Other informationOther information– User AgentUser Agent
Kind of browserKind of browser
– If-Modified-SinceIf-Modified-Since Returns object only if more recent than Returns object only if more recent than
given dategiven date Otherwise returns status code 304Otherwise returns status code 304
HTTP 20
HTTP 1.0HTTP 1.0
Other informationOther information– AcceptAccept
Mime types which browser can acceptMime types which browser can accept– Multipurpose Internet Mail ExtensionMultipurpose Internet Mail Extension
text/plaintext/plain text/htmltext/html application/postscriptapplication/postscript image/gifimage/gif image/jpegimage/jpeg audio/basicaudio/basic video/mpegvideo/mpeg x-world/x-vrmlx-world/x-vrml
HTTP 21
HTTP 1.0HTTP 1.0
Other informationOther information– AuthorizationAuthorization
User passwordUser passwordGET /X/Y/Z.HTML HTTP 1.0GET /X/Y/Z.HTML HTTP 1.0
User Agent: Prodigy-WB/1.3eUser Agent: Prodigy-WB/1.3e
Accept: text/plainAccept: text/plain
Accept: text/htmlAccept: text/html
Accept: application/postscriptAccept: application/postscript
Accept: image/gifAccept: image/gif
– Accept: */*Accept: */*
HTTP 22
HTTP 1.0HTTP 1.0
HTTP responseHTTP response– Status lineStatus line
HTTP-version Status-code ReasonHTTP-version Status-code Reason Status-codes 1xx - InformationalStatus-codes 1xx - Informational
– Reserved for future useReserved for future use
HTTP 23
HTTP 1.0HTTP 1.0
HTTP responseHTTP response– Status lineStatus line
Status-codes 2xx - SuccessStatus-codes 2xx - Success– The action was successfully received, The action was successfully received,
understood, and acceptedunderstood, and accepted 200 OK200 OK 201201 POST command POST command
successfulsuccessful 202202 Request acceptedRequest accepted 203203 GET or HEAD request GET or HEAD request
fulfilledfulfilled 204204 No contentNo content
HTTP 24
HTTP 1.0HTTP 1.0
HTTP responseHTTP response– Status lineStatus line
Status-codes 3xx - RedirectionStatus-codes 3xx - Redirection– Further action must be taken in order to Further action must be taken in order to
complete requestcomplete request 300300 Resource found at Resource found at
multiple locationsmultiple locations 301 Resource moved permanently301 Resource moved permanently 302 Resource moved temporarily302 Resource moved temporarily 304 Resource has not modified (since 304 Resource has not modified (since
date)date)
HTTP 25
HTTP 1.0HTTP 1.0
HTTP responseHTTP response– Status lineStatus line
Status-codes 4xx - Client errorStatus-codes 4xx - Client error– The request contains bad syntax or cannot be fulfilledThe request contains bad syntax or cannot be fulfilled
400400 Bad request from clientBad request from client 401401 Unauthorized requestUnauthorized request 402402 Payment required for requestPayment required for request 403403 Resource access forbiddenResource access forbidden 404404 Resource not foundResource not found 405405 Method not allowed for Method not allowed for
resourceresource 406406 Resource type not acceptableResource type not acceptable
HTTP 26
HTTP 1.0HTTP 1.0
HTTP responseHTTP response– Status lineStatus line
Status-codes 5xx - Server errorStatus-codes 5xx - Server error– The server failed to fulfill an apparently valid requestThe server failed to fulfill an apparently valid request
500500 Internal server errorInternal server error 501501 Method not implementedMethod not implemented 502502 Bad gateway or server Bad gateway or server
overloadoverload 503503 Service unavailable / Service unavailable /
gateway timeoutgateway timeout 504504 Secondary gateway / server Secondary gateway / server
timeouttimeout
HTTP 27
HTTP 1.0HTTP 1.0
HTTP responseHTTP response– Description of informationDescription of information
Server Server Type of server Type of server Date Date Date and time Date and time Content-LengthContent-Length Number of bytes Number of bytes Content-TypeContent-Type Mime type Mime type Content-LanguageContent-Language English, for example English, for example Content-EncodingContent-Encoding Data compression Data compression Last-ModifiedLast-Modified Date when last modified Date when last modified ExpiresExpires Date when file becomes Date when file becomes
invalidinvalid
HTTP 28
HTTP 1.0HTTP 1.0
ProblemsProblems– HTTP is statelessHTTP is stateless
Each request requires separate TCP Each request requires separate TCP connectionconnection
Server doesn’t remember previous Server doesn’t remember previous requestsrequests
HTTP 29
Evolution of HTTPEvolution of HTTP
HTTP/0.9 - 1990HTTP/0.9 - 1990– Request method + URI + crlfRequest method + URI + crlf
GET /pets/index.htmlGET /pets/index.html Just file contents sent backJust file contents sent back
– No header informationNo header information
Gopher influenceGopher influence– Media typesMedia types
Single character indicated one of ten Single character indicated one of ten typestypes
HTTP 30
Evolution of HTTPEvolution of HTTP
HTTP/1.0 - 1995HTTP/1.0 - 1995– Meta-information between client and Meta-information between client and
serverserver Media typesMedia types
– MIME type/subtypeMIME type/subtype Status codesStatus codes This information influenced the development This information influenced the development
of web search enginesof web search engines
– CachingCaching– AuthorizationAuthorization
HTTP 31
Evolution of HTTPEvolution of HTTP
HTTP/1.0 - 1995HTTP/1.0 - 1995– ProblemsProblems
ScalabilityScalability– High number of clients visit server for short High number of clients visit server for short
timetime Flash crowdFlash crowd
BandwidthBandwidth
HTTP 32
Evolution of HTTPEvolution of HTTP
HTTP/1.1HTTP/1.1– Byte rangesByte ranges
Request of a document subsetRequest of a document subset– Adobe's Portable Document FormatAdobe's Portable Document Format– Streaming multimediaStreaming multimedia
Eliminates unnecessary client/server Eliminates unnecessary client/server communicationcommunication
An interrupted transfer which is restarted An interrupted transfer which is restarted can be more efficientcan be more efficient
HTTP 33
Evolution of HTTPEvolution of HTTP
HTTP/1.1HTTP/1.1– Content negotiation with quality Content negotiation with quality
factorsfactors Quality factorsQuality factors
– Real numbers between 0 and 1Real numbers between 0 and 1 Default is 1Default is 1
Accept-Language: fr, en-gb; q=0.8, en; Accept-Language: fr, en-gb; q=0.8, en; q=0.7q=0.7
HTTP 34
Evolution of HTTPEvolution of HTTP
HTTP/1.1HTTP/1.1– Chunked encodingChunked encoding
Transmission of streaming multimediaTransmission of streaming multimedia– One frame varies in size and composition from One frame varies in size and composition from
the nextthe next Streaming videoStreaming video
– Entire image transmitted in first chunk and Entire image transmitted in first chunk and differences to the previous image are differences to the previous image are transmitted in the next chunktransmitted in the next chunk
HTTP 35
Evolution of HTTPEvolution of HTTP
HTTP/1.1HTTP/1.1– Protocol switchingProtocol switching
Client can specify another protocol more Client can specify another protocol more suited to data being transferredsuited to data being transferred
– Message integrity checksMessage integrity checks– Digest authenticationDigest authentication
In HTTP/1.0, user sent username and In HTTP/1.0, user sent username and password over the networkpassword over the network
In HTTP/1.1, the client and the server never In HTTP/1.1, the client and the server never send the actual username or password over send the actual username or password over the networkthe network
HTTP 36
Evolution of HTTPEvolution of HTTP
HTTP/1.1HTTP/1.1– Persistent connectionsPersistent connections
In HTTP/1.0, if a single page includes inline In HTTP/1.0, if a single page includes inline images, multiple frames, animation, and images, multiple frames, animation, and other external references, to browse this other external references, to browse this page would require many reconnectionspage would require many reconnections
In HTTP/1.1 there are multiple In HTTP/1.1 there are multiple request/response transactions per connectionrequest/response transactions per connection
Clients can pipeline requests to the server by Clients can pipeline requests to the server by sending multiple requests at start of sessionsending multiple requests at start of session
HTTP 37
Evolution of HTTPEvolution of HTTP HTTP/1.1HTTP/1.1
– Cache management with entity tagsCache management with entity tags When body of URI changes, so does its entity When body of URI changes, so does its entity
tagtag– Useful for maintaining caches, as updated URI Useful for maintaining caches, as updated URI
information would have a different entity taginformation would have a different entity tag Can tell if same resource is being cached from Can tell if same resource is being cached from
multiple URI's as it would have same entity tagmultiple URI's as it would have same entity tag Strong entity tagStrong entity tag
– Changes when any portion of resource changesChanges when any portion of resource changes One or more bytes changeOne or more bytes change
Weak entity tagWeak entity tag– Changes only when semantics of entity-body Changes only when semantics of entity-body
changeschanges
HTTP 38
Evolution of HTTPEvolution of HTTP
HTTP/1.1HTTP/1.1– Software multihomingSoftware multihoming
Number of available IP addresses is a Number of available IP addresses is a concernconcern
In HTTP/1.0, server could have multiple In HTTP/1.0, server could have multiple DNS entries and IP addresses, each DNS entries and IP addresses, each corresponding to different document treecorresponding to different document tree
In HTTP/1.1, server could have multiple In HTTP/1.1, server could have multiple DNS entries and only a single IP addressDNS entries and only a single IP address
HTTP 39
The FutureThe Future
HTTP-Next GenerationHTTP-Next Generation– Many channelsMany channels
One TCP connection carries multiple One TCP connection carries multiple channels for parallel communicationchannels for parallel communication
Different protocols on each channelDifferent protocols on each channel
– Traditional wayTraditional way Multiple TCP connections between same Multiple TCP connections between same
client and serverclient and server Pages contain images, video, audio, and Pages contain images, video, audio, and
htmlhtml
HTTP 40
The FutureThe Future
ExtensibilityExtensibility– Adding new MIME headers has been Adding new MIME headers has been
the traditional way of extending httpthe traditional way of extending http– DrawbacksDrawbacks
No indication whether receiving end No indication whether receiving end understands these extensionsunderstands these extensions
No indication whether extension is No indication whether extension is intended for all parties along message path intended for all parties along message path or only for certain intermediariesor only for certain intermediaries
No indication of order in which extensions No indication of order in which extensions should be interpretedshould be interpreted
HTTP 41
The FutureThe Future
ExtensibilityExtensibility– PEPPEP
Protocol Extension ProtocolProtocol Extension Protocol
HTTP 42
The FutureThe Future
PerformancePerformance– Parsing MIME headers wastes resourcesParsing MIME headers wastes resources– Sticky headersSticky headers
Persistent state between multiple http Persistent state between multiple http requestsrequests
Not all headers have to be included in every Not all headers have to be included in every http messagehttp message
Distributed authoringDistributed authoring– Event notificationEvent notification
HTTP 43
The FutureThe Future
Caching and replicationCaching and replication– Popular sites are Popular sites are really really popularpopular– Flash crowds happenFlash crowds happen– Hot spots on the net are dynamicHot spots on the net are dynamic– Amount of dynamic data is increasingAmount of dynamic data is increasing
HTTP 44
The FutureThe Future
QoSQoS– Quality of serviceQuality of service– Not everything must be treated with Not everything must be treated with
same QoSsame QoS– Required QoS should be made at the Required QoS should be made at the
user-interfaceuser-interface
HTTP 45
The FutureThe Future
Real-time protocols and the webReal-time protocols and the web– Streaming protocolsStreaming protocols
Audio/video-on-demandAudio/video-on-demand