telnet 80 | tee one.dat Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mklein/index.html HTTP/1.1 Connection: close Host: HTTP/ OK Date: Wed, 27 Jan :28:36 GMT Server: Apache/ (Unix) DAV/2 PHP/ Last-Modified: Wed, 13 Jan :55:23 GMT ETag: "64371b-54b-47d0f797c18d9" Accept-Ranges: bytes Content-Length: 1355 Content-Type: text/html
Download presentation
Presentation is loading. Please wait.
Published byMarie-Paule Laviolette Modified over 5 years ago
1
Web Server Design Week 3 Old Dominion University
Department of Computer Science CS 495/595 Spring 2010 Martin Klein 1/27/10
2
Entity Tags: “Etag” ETag: "64371b-54b-47d0f797c18d9"
> telnet 80 | tee one.dat Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. GET /~mklein/index.html HTTP/1.1 Connection: close Host: HTTP/ OK Date: Wed, 27 Jan :28:36 GMT Server: Apache/ (Unix) DAV/2 PHP/5.2.11 Last-Modified: Wed, 13 Jan :55:23 GMT ETag: "64371b-54b-47d0f797c18d9" Accept-Ranges: bytes Content-Length: 1355 Content-Type: text/html <html> <head><title>Martin Klein -- Old Dominion University</title></head> <body> [lots of html deleted] Connection closed by foreign host.
3
What is an “Entity”? section 1.3: entity
The information transferred as the payload of a request or response. An entity consists of metainformation in the form of entity-header fields and content in the form of an entity-body, as described in section 7. section 7: An entity consists of entity-header fields and an entity-body, although some responses will only include the entity-headers.
4
Looking at a Request/Response
(as much as we have learned so far) Request Response GET /~mklein/index.html HTTP/1.1 Request Headers: HTTP/ OK Response Headers: Host: Server: Apache... General Headers: Date: Wed, 27 Jan :04:47 GMT Connection: close Entity Headers: Content-Length: 0 Content-Type: text/html ... CRLF [ message-body ]
5
Entity Headers Are (Mostly) a Subset of Response Headers
7.1 Entity Header Fields Entity-header fields define metainformation about the entity-body or, if no body is present, about the resource identified by the request. Some of this metainformation is OPTIONAL; some might be REQUIRED by portions of this specification. entity-header = Allow ; Section 14.7 | Content-Encoding ; Section 14.11 | Content-Language ; Section 14.12 | Content-Length ; Section 14.13 | Content-Location ; Section 14.14 | Content-MD ; Section 14.15 | Content-Range ; Section 14.16 | Content-Type ; Section 14.17 | Expires ; Section 14.21 | Last-Modified ; Section 14.29 | extension-header extension-header = message-header
6
Section 3.11 - Entity Tags Etags used in request headers
response headers An entity tag consists of an opaque quoted string, possibly prefixed by a weakness indicator. […] A "strong entity tag" MAY be shared by two entities of a resource only if they are equivalent by octet equality. A "weak entity tag," indicated by the "W/" prefix, MAY be shared by two entities of a resource only if the entities are equivalent and could be substituted for each other with no significant change in semantics. A weak entity tag can only be used for weak comparison. An entity tag MUST be unique across all versions of all entities associated with a particular resource. A given entity tag value MAY be used for entities obtained by requests on different URIs. The use of the same entity tag value in conjunction with entities obtained by requests on different URIs does not imply the equivalence of those entities.
7
Opaqueness A string / tag / pointer / data structure whose semantics / implementation are hidden/local Q: What does “1c52-14ed-42992d1d” mean? A: it doesn’t matter… Examples: ATM & CC data strips Hotel & Flight reservation codes http cookies
8
Section 13.3.3 Weak and Strong Validators
Entity tags are normally "strong validators," but the protocol provides a mechanism to tag an entity tag as "weak." One can think of a strong validator as one that changes whenever the bits of an entity changes, while a weak value changes whenever the meaning of an entity changes. Alternatively, one can think of a strong validator as part of an identifier for a specific entity, while a weak validator is part of an identifier for a set of semantically equivalent entities. Note: One example of a strong validator is an integer that is incremented in stable storage every time an entity is changed. An entity's modification time, if represented with one-second resolution, could be a weak validator, since it is possible that the resource might be modified twice during a single second. Support for weak validators is optional. However, weak validators allow for more efficient caching of equivalent objects; … strong = exact match; weak = “good enough” match
9
Common Hash Functions Variable length input, fixed length output
Can’t be reversed small changes in input, large changes in output MD5 SHA-1 (mln-web:~) mklein% cat aaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (mln-web:~) mklein% cat aba aaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (mln-web:~) mklein% md5sum aaa 8655d873149db8d79106de20d1e89ffc aaa (mln-web:~) mklein% md5sum aba aafb727b9c4729a80694d6c16dfa92be aba
10
Possible Approaches Strong: Weak: md5(entitybody+entityheaders)
11
How Does Apache Do It? A configurable function with default inputs of (inode, size, modification time): Direct relationship to three parts of: ETag: "1c52-14ed-42992d1d" ?? Probably, but look in the Apache source code to be sure let’s run a test…
12
Black Box Test request: (mln-web:~) mklein% telnet www.cs.odu.edu 80
Trying Connected to xenon.cs.odu.edu. Escape character is '^]'. HEAD /~mklein/teaching/cs595-s10/etag-test/foo.txt HTTP/1.1 Connection: close Host: request: HTTP/ OK Date: Wed, 27 Jan :26:37 GMT Server: Apache/ (Unix) DAV/2 PHP/5.2.11 Last-Modified: Wed, 27 Jan :09:48 GMT ETag: " e294ed23307" Accept-Ranges: bytes Content-Length: 21 Connection: close Content-Type: text/plain HTTP/ OK Date: Wed, 27 Jan :27:21 GMT Server: Apache/ (Unix) DAV/2 PHP/5.2.11 Last-Modified: Wed, 27 Jan :09:48 GMT ETag: " e294ed23307" Accept-Ranges: bytes Content-Length: 21 Connection: close Content-Type: text/plain % cat .htaccess FileETag INode MTime Size % cat .htaccess FileETag INode MTime HTTP/ OK Date: Wed, 27 Jan :28:06 GMT Server: Apache/ (Unix) DAV/2 PHP/5.2.11 Last-Modified: Wed, 27 Jan :09:48 GMT ETag: "102398" Accept-Ranges: bytes Content-Length: 21 Connection: close Content-Type: text/plain HTTP/ OK Date: Wed, 27 Jan :28:36 GMT Server: Apache/ (Unix) DAV/2 PHP/5.2.11 Last-Modified: Wed, 27 Jan :09:48 GMT Accept-Ranges: bytes Content-Length: 21 Connection: close Content-Type: text/plain % cat .htaccess FileETag INode % cat .htaccess FileETag None
13
(original) ETag: " 102398-15-47e294ed23307 "
(contd) (original) ETag: " e294ed23307 " HTTP/ OK Date: Wed, 27 Jan :30:18 GMT Server: Apache/ (Unix) DAV/2 PHP/5.2.11 Last-Modified: Wed, 27 Jan :30:04 GMT ETag: " e29974ce300" Accept-Ranges: bytes Content-Length: 21 Connection: close Content-Type: text/plain HTTP/ OK Date: Wed, 27 Jan :31:08 GMT Server: Apache/ (Unix) DAV/2 PHP/5.2.11 Last-Modified: Wed, 27 Jan :30:52 GMT ETag: " e299a294f00" Accept-Ranges: bytes Content-Length: 25 Connection: close Content-Type: text/plain % touch foo.txt % echo "bar" >> foo.txt
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.