On Thu, 2010-02-18 at 14:32 +0100, Jocelyn Jaubert wrote: > Hi Jon, > > On Wed, Feb 17, 2010 at 11:37 PM, Jon Burgess > <jburgess...@googlemail.com> wrote: > >> But if you try on the OSM server, then it works correctly: no tile is > >> sent by the server if viking already has a recent tile. > > > > Do you mean that the osmarender server works as you expect here? > > Exactly - I meant that the osmarender server accepts the > If-Modified-Since header, and returns 304 if the server file is older > or the same date than the client file. > > > > When the client makes a request it should store the ETag returned. When > > it comes to request the tile again the client includes this ETag in a > > If-None-Match header. If the current tile on the server still has the > > same content then this will trigger a 304/NotModified response. I have > > included an example of in an attachment. > > > > We also return "Expires:" and "Cache-Control:" headers which can assist > > the client in deciding when to try requesting the tile again. > > > > All these headers are defined in the various HTTP RFCs. In theory, > > properly written web browsers and caches should work fine with them but > > I am beginning to wonder whether I should discard the ETag and move back > > to a simple last-modified time system. > > Thanks for the explanation. Guilhem is right in pointing that the > client will need to store the ETag value as a metadata, which makes > ETag support not as easy to implement as last-modified. > > Do you know if any software uses ETag with tile.openstreetmap.org ?
Firefox successfully makes use of the ETag. If you load a tile into the browser and then hit F5 it will use the ETag and not the timestamp to check if the file needs updating. An abbreviated copy of the HTTP request response headers is shown below. Initial request from Browser: * GET /0/0/0.png HTTP/1.1 * User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.1.6) Gecko/20100107 Fedora/3.5.6-1.fc12 Firefox/3.5.6 .. Response: * HTTP/1.1 200 OK * ETag: "ca7a4b4da619bacf8f8c45dfb2661bc8" * Content-Length: 8571 ... Then hit F5 to force refresh of tile in firefox window Refresh request: * GET /0/0/0.png HTTP/1.1 * If-None-Match: "ca7a4b4da619bacf8f8c45dfb2661bc8" ... (there are no If-Modified-Since headers in the request) Response: HTTP/1.1 304 Not Modified ... You can see the metadata which Firefox maintains about the cached objects by entering the following URL into the address bar: about: cache > I will look tonight if it is simple to use ETag with viking and > libcurl - it should only be a matter of adding "file.etag" alongside > the image file. > > > Thanks, > Jocelyn ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Viking-devel mailing list Viking-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/viking-devel Viking home page: http://viking.sf.net/