1 HTTP messages Entities and Encoding Herng-Yow Chen.

Slides:



Advertisements
Similar presentations
Enabling Secure Internet Access with ISA Server
Advertisements

TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
HTTP – HyperText Transfer Protocol
Web basics HTTP – – URI/L/Ns – HTML –
1 HTTP – HyperText Transfer Protocol Part 1. 2 Common Protocols In order for two remote machines to “ understand ” each other they should –‘‘ speak the.
16-Jun-15 HTTP Hypertext Transfer Protocol. 2 HTTP messages HTTP is the language that web clients and web servers use to talk to each other HTTP is largely.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
HTTP Headers. Read these slides yourselves This set of slides explains the header fields which are pre-defined in HTTP/1.1 Read these slides yourselves.
How the web works: HTTP and CGI explained
HTTP Presented By: Holly Mortinson Amy Drout Kyle Balmer & Matt Conklin.
The World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
1 The HyperText Transfer Protocol: HTTP Nick Smith Stuart Alley Tara Tjaden.
Definitions, Definitions, Definitions Lead to Understanding.
HTTP HyperText Transfer Protocol Part 3.
HTTP Overview Vijayan Sugumaran School of Business Administration Oakland University.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
Hypertext Transport Protocol CS Dick Steflik.
CSC 2720 Building Web Applications Servlet – Getting and Setting HTTP Headers.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
Web Architecture Dr. Frank McCown Intro to Web Science Harding University This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike.
Java Technology and Applications
Krerk Piromsopa. Web Caching Krerk Piromsopa. Department of Computer Engineering. Chulalongkorn University.
HTTP Protocol Specification
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
HyperText Transfer Protocol (HTTP).  HTTP is the protocol that supports communication between web browsers and web servers.  A “Web Server” is a HTTP.
CSC 2720 Building Web Applications Getting and Setting HTTP Headers (With PHP Examples)
1 HTTP Messages Herng-Yow Chen. 2 Outline The Flow of Messages The Parts of a Message The various methods that request message support The various status.
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Understand the components of a browser and a server Understand.
Application Layer 2 Figures from Kurose and Ross
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
Sistem Jaringan dan Komunikasi Data #9. DNS The Internet Directory Service  the Domain Name Service (DNS) provides mapping between host name & IP address.
The HyperText Transfer Protocol. History HTTP has been in use since 1990 (HTTP/0.9) HTTP/1.0 was defined in RFC 1945 (May 1996) and included metainformation.
HTTP Hypertext Transfer Protocol RFC 1945 (HTTP 1.0) RFC 2616 (HTTP 1.1)
Proxy Lab Recitation I Monday Nov 20, 2006.
Web Server Design Week 8 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/3/10.
Web Server Design Week 4 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/03/10.
Form Data Encoding GET – URL encoded POST – URL encoded
2: Application Layer 1 Chapter 2: Application layer r 2.1 Principles of network applications  app architectures  app requirements r 2.2 Web and HTTP.
CITA 310 Section 2 HTTP (Selected Topics from Textbook Chapter 6)
HTTP How the Internet servers and clients communicate.
Web Server Design Week 7 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/24/10.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/7/10.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
Overview of Servlets and JSP
Computer Networks with Internet Technology William Stallings Chapter 04 Modern Applications 4.1 Web Access - HTTP.
Web Server Design Week 6 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/17/10.
World Wide Web r Most Web pages consist of: m base HTML page, and m several referenced objects addressed by a URL r URL has two components: host name and.
Web Protocols: HTTP COMP6017 Topics on Web Services Dr Nicholas Gibbins –
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Free Powerpoint Templates Page 1 Free Powerpoint Templates CHAPTER 1 LAB 1.1 Web Server.
Web Server Design Week 3 Old Dominion University Department of Computer Science CS 495/595 Spring 2006 Michael L. Nelson 1/23/06.
What’s Really Happening
Hypertext Transfer Protocol (HTTP) COMP6218 Web Architecture Dr Nicholas Gibbins –
Hypertext Transfer Protocol
HTTP – An overview.
Hypertext Transfer Protocol
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
Hypertext Transport Protocol
Web Caching? Web Caching:.
Web Server Design Week 8 Old Dominion University
Web Server Design Week 7 Old Dominion University
IS333D: MULTI-TIER APPLICATION DEVELOPMENT
Hypertext Transfer Protocol
Web Server Design Week 8 Old Dominion University
Web Server Design Week 8 Old Dominion University
HTTP Hypertext Transfer Protocol
Presentation transcript:

1 HTTP messages Entities and Encoding Herng-Yow Chen

2 Outline The format and behavior of HTTP message entities as HTTP containers How HTTP describes the size of entity bodies, and what HTTP requires in the way of sizing The entity headers used to describe the format, alphabet, and language of content, so clients can process it properly

3 Reversible content encoding transforms data format to take up less space or be more secure Transfer encoding modifies how HTTP ships data to enhance the communication of some kinds of data Chunked encoding chops data into multiple pieces to deliver content of unknown length safely

4 The assortment of tags, labels, times, and checksums help clients get the latest version of requested content Ranges are useful for continuing aborted downloads where they left off Delta encoding extensions allow client to request just those parts of a web page that actually have changed since a previously viewed revision

5 Checksums of entity bodies are used to detect changes in entity content as it passes through proxies

6 Message is made up of header and body HTTP/ OK Server: Netscape_Enterprise/3.6 Date: Sun, 17 Sep :01:05 GMT Content_type: text/plain Content-length :18 Hi!I ’ m a message! Entity body Entity headers Entity

7 HTTP 1.1 defines 10 entity headers Content-Type Content-Length Content-Language Content-Encoding Content-Location Content-Range Content-MD5 Last-Modified Expires Allow ETag Cache-Control

8 Entity Bodies

9 Why content-length is important? Detecting Truncation Incorrect Content-Length problems? When connection is persistent, where one entity body ends and the next message begins. Chunked encoding is an alternate, sending the data in a series of chunks, each with a specified chunk size. When content-encoding is applied Content-length refers to the encoded body, not the length of the original, unencoded body.

10 Entity Digest Content-MD5 Is used to check message integrity Also can be used as a key into a hash table to quickly locate documents and reduce duplicate storage of content.

11 Media type and Charset Content-type refers to original entity body type before encoding. Support optional parameters to further specify the content type. Character Encodings for Text Media Content-Type: text/html; charset=iso

12 Common media types Media typeDescription Text/htmlEntity body is an HTML document Text/plainEntity body is a document in plain text Image/gifEntity body is an image of type GIF Image/jpegEntity body is an image of type JPEG Audio/x-wavEntity body contains WAV sound data Model/vrmlEntity body is a three-dimensional VRML model Application/vnd.ms-powerpointEntity body is a Microsoft PowerPoint presentation Multipart/byterangesEntity body has multiple parts,each containing a different range(in bytes) of the full document Message/httpEntity body contains a complete HTTP message (see TRACE)

13 Multipart Media Types MIME “ multipart ” messages contain multiple messages stuck together and sent as a single, complex message. Each component is self-contained, with its own headers describing its contents; the different components are concatenated together and delimited by a string. HTTP also supports multipart bodies; however, only used in two cases: fill-in form submission and range responses carrying pieces of a document.

14 Multipart Form Submissions Your Name? Your File to send?

15 If the user enters “ John ” and selects the text file “ hello.txt ” Content-Type: multipart/form-data; boundary=AaBo3x --AaBo3x Content-Disposition: form-data; name= “ submit-name ” John --AaBo3x Content-Disposition: form-data; name= “ files ” ; filename= “ hello.txt ” Content-Type: text/plain … contents of hello.txt … --AaBo3x

16 If selects the text file “ hello.txt ” and the second image file “ image.gif ” Content-Type: multipart/form-data; boundary=AaBo3x --AaBo3x Content-Disposition: form-data; name= “ submit-name ” John --AaBo3x Content-Disposition: form-data; name= “ files ” ; Content-type: multipart/mixed; boundary=BbC04y --BbC04y Content-Disposition: file: filename= “ hello.txt ” Content-type: text/plain … contents of hello.txt … --BbC04y Content-Disposition: file: filename= “ image.gif ” Content-Type: image/gif Content-Transfer-Encoding: binary … contents of image.gif … --BbC04y --AaBo3x

17 Multipart Range Response HTTP/ Partial Content Server: Microsoft-IIS/5.0 Content-Location: Content-Type: martipart/x-byteranges; boundary=--[abcdefghik … z] [abcdefghik … z] — Content-Type: text/plain Content-Range: bytes 0-174/1441 …. Part I content [abcdefghik … z]-- Content-Type: text/plain Content-Range: bytes /1441 …. Part II content [abcdefghik … z]--

18 Content-Encoding HTTP applications sometimes want to encode content before sending it, to help lesson the time it takes to transmit the data. Content-Type is the type of the original format, before encoding Content-Length is the length of the encoded length

19 Content Encoding Original content Content-Type: text/html Content-Length: Original content Content-Type: text/html Content-Length: Content-encoded content Content-Type: text/html Content-Length: 5746 content-encoding: gzip Gzip content decoder Gzip content encoder

20 Content-encoding tokens Content-encoding value Description gzipUsing the GNU zip encoding (RFC1952) compressUsing the UNIX file compression program deflateUsing zlib format (RFC1950) for deflate compression (RFC 1951) identityNo encoding has been performed. When a Content-encoding header is not present, this can be assumed.

21 Accept-Encoding Headers server client HTTP/ OK Content-type: image/gif Content-encoding: gzip [ … ] Request message Response message … … The server compresses the image with gzip to transport a smaller file over the thin Network connection between itself and the client.This saves network bandwidth And reduces the amount of time that the client waits for the transfer.Though,the Client will have to spend time decompressing the image once the image is served. gzipgunzip GET /logo.gif HTTP/1.1 Accept-encoding: gzip [ … ]

22 Client can indicate preferred encodings by attaching Q values Accept-Encoding: compress, gzip Accept-Encoding: Accept-Encoding: * Accept-Encoding: compress;q=0.5, gzip;q=1.0 Accept-Encoding: gzip;q=1.0, identity;q=0.5; *;q=0

23 Transfer Encoding Content-Encodings are to deal with the entity content to be encoded for less- space or security reason, tightly associated with the content format. In comparison, transfer encodings are applied for architectural reasons and are independent of the content format.

24 Content encoding vs. transfer encoding HTTP/ OK content-encoding: gzip Content-Type: text/html [ … ] [encoded message] HTTP/ OK Transfer-encoding: Chunked 10 abcdefghijk 1 a Content-encoded response Transfer-encoded response Normal header block Normal entity (just encoded) Basic header Encoded blocks A content-encoded message just encodes the entity Section of the message. With Transfer-encoded Messages the encoding is a function of the entire Message, changing the structure of the message itself

25 Transfer-Encoding Headers TE Used in the request header to tell the server what extension transfer encoding are okay to use. Transfer-Encoding Used in the response header to tell the receiver (client) what encoding has been perform

26 Example GET /1.html HTTP/1.1 Host: User-Agent: Mozilla/4.61 TE: trailers, chunked HTTP/ ok Transfer-Encoding: chunked Server: Apache 3.0

27 Chunked Encoding

28 Chunked Encoding (continued) Chunking and Persistent connection Trailers in chunked messages Combining Content and Transfer Encoding

29 Combining Content and Transfer Encodings 9BF2578EA4 2670CD 9BF2578EA4 2670CD 426 8EA B 426 8EA B Content encoding Transfer encoding (chunking) Content-type: text/heml Content-Type: text/html content-encoding: gzip Content-Type: text/html content-encoding: gzip Transfer-encoding: chunked

30 Time-Varying Instance Web objects usually are not static. The same URL can, over time, point to different versions of an object. For example, the website of any media company like CNN, and BBC.

31 Time-Varying Instances

32 Validators and Freshness In the previous CNN example, the client got the initial resource V1 and can cache this copy, but for how long? Once the document has “ expired ” at the client, it must request a fresh copy from the server. Using a “ conditional request ” to tell the server which version it currently has, using a validator, and ask for a copy to be sent only if its current copy is no long valid.

33 Cache-Control header directives DirectiveMessage type no-cacheRequest no-storeRequest max-ageRequest max-freshRequest no-transformRequest only-if-cachedRequest publicResponse privateResponse

34 Cache-Control header directives DirectiveMessage type no-cacheResponse no-storeResponse no-transformResponse must-revalidateResponse proxy-revalidateResponse max-ageResponse s-max-ageResponse

35 Conditional request types Request typevalidator If-Modified-SinceLast-Modified If-Unmodified-SinceLast-Modified If-MatchETag If-None-MatchETag

36 Range Request HTTP allows clients to actually request just part or a range of a document. Applications: Request RoI (Region of Interest) Media Indexing and Access Streaming applications

37 Range Requests GET /bigfile.html HTTP/1.1 [ … ] GET /bigfile.html HTTP/1.1 Range: bytes= [ … ] HTTP/ OK Content-Type: text/html Content-Length: Accept-Ranges: bytes [ … ] HTTP/ OK Content-Type: text/html Range: bytes= Accept-Ranges: bytes [ … ] Response message Range response message Request message client The client ’ s original request was Interrupted,but a second request For the part of the message that Was not received allows the Client to resume form the point Of the interruption Range request message

38 Delta Encoding An extension to the HTTP protocol that optimizes transfer by communicating changes instead of entire objects. RFC 3229 describe delta encoding.

39 Delta Encoding

40 Delta Encoding

41 Delta-encoding headers Etag If-None-Match A-IM IM Delta-Base

42 IANA registered types of instance manipulations TypeDescription vcdiff Delta using the vcdiff algorithm diffe Delta using the Unix diff-e command gdiff Delta using the gdiff algorithm gzip Compression using the gzip algorithm deflate Compression using the deflate algorithm range Used in a server response to indicate that the response is partial content as the result of a range selection identity Used in a client request ’ s A-IM header to indicate that the client is willing to accept an identity instance manipulation

43 For More Information Hypertext Transfer Protocol -- HTTP/1.1 Delta encoding in HTTP MIME (Multipurpose Internet Mail Extensions) Part One:Mechanisms for Specifying and Describing the Format of Internet Message Bodies Multipurpose Internet Mail Extensions(MIME) Part One:Format of Internet Message Bodies The Content-MD5 Header Field Instance Digests in HTTP