[OSM-dev] API returns zipped data?

Frederik Ramm frederik at remote.org
Sun Nov 7 11:54:26 GMT 2010


Hi,

Maarten Deen wrote:
> The general information in http://wiki.openstreetmap.org/wiki/API_v0.6 
> talks about that the payload may be compressed, but I'm not sure what is 
> meant by payload. Is this the request going to the api or is this what 
> the api returns?

The payload is what follows the empty line after the headers in the HTTP 
message.

> It also states that this should only happen when the client indicates 
> this through the HTTP "Accept" header. But the client I'm using, Lynx, 
> does not do so.

It probably does. Compare these two manual requests:

$ (echo "GET /api/0.6/node/123456 HTTP/1.0"; echo) | nc 
api.openstreetmap.org 80
HTTP/1.1 200 OK
Date: Sun, 07 Nov 2010 11:52:38 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.2.15
X-Runtime: 32
Cache-Control: private, max-age=0, must-revalidate
Set-Cookie: _osm_session=196753896ce30e4ca972ac0766555ff5; path=/; HttpOnly
Last-Modified: Sat, 13 Dec 2008 15:05:11 GMT
Content-Length: 262
Status: 200
Vary: Accept-Encoding
Connection: close
Content-Type: text/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="OpenStreetMap server">
   <node id="123456" lat="51.2153688" lon="4.089274" version="8" 
changeset="359445" user="Benjamiini" uid="65172" visible="true" 
timestamp="2008-12-13T15:05:11Z"/>
</osm>


$ (echo "GET /api/0.6/node/123456 HTTP/1.0"; echo "Accept-encoding: 
gzip, deflate"; echo) | nc api.openstreetmap.org 80
HTTP/1.1 200 OK
Date: Sun, 07 Nov 2010 11:53:12 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.2.15
X-Runtime: 15
Cache-Control: private, max-age=0, must-revalidate
Content-encoding: gzip
Set-Cookie: _osm_session=9c619c6ce74761ff27b7ed69b4283f4a; path=/; HttpOnly
Last-Modified: Sat, 13 Dec 2008 15:05:11 GMT
Content-Length: 221
Status: 200
Connection: close
Content-Type: text/xml; charset=utf-8

(??E?1o??w?
t????R?nU?$K7?*?????)?}?7???~1???`oi??p???NS3?^-????]M??\3b?? 
S???$?????Z??B?<??? ?
 
               ^?????`A"z}PJ{???????}?/   ??h???>`?.l$?????!?`G?v4lj??N

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"



More information about the dev mailing list