[OSM-dev] HTTP error 417 with cURL

David Earl david at frankieandshadow.com
Fri May 11 10:44:12 BST 2007



> -----Original Message-----
> From: Nick Whitelegg [mailto:nick at hogweed.org]
> Sent: 11 May 2007 10:33
> To: David Earl
> Cc: dev at openstreetmap.org
> Subject: Re: [OSM-dev] HTTP error 417 with cURL
>
>
> On Friday 11 May 2007 10:04, you wrote:
> > > Tried an empty string and even null, but no luck. Seems I'll have
> > > to write the
> > > header myself, though the easiest fix is probably to stop lighthttpd
> > > rejecting this line :-)
> >
> > Useful to see this being discussed, as I was trying a node
> upload for the
> > first time and assumed it was me doing something wrong when I
> was getting
> > 417.
> >
> > One thing you could do (and I'll try) is do an exec of the command line
> > cUrl instead of using the function api.
> >
> > Can people tell me, though, what I should be doing for the XML for the
> > node. (i.e. what, in detail, is" node payload" in the 0.4
> documentation. In
> > particular:
> >
> > - do I need the <osm> wrapper element, or just the <node> element
>
> As far as I know you need the <osm> as for 0.3, but with 'version=0.4'
> instead.
>
> All you need for a new node is the <osm> and the <node>. Nothing else is
> necessary.


My problem is that I haven't done this before, so I don't have the 0.3
knowledge either. It's not so much the structure, but the 0.3 documentation
says "XML like the above", and that includes various admin elements which
I'm not sure whether to reflect back at the server.

Anywhow, uploading the the following works, so I assume this is OK, though
the server may be ignoring some of what I tell it. (The tags are just what
happens to be in this node).

<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.4' generator='OSM mini node editor'>
<node id='20823872' visible='true' lat='52.2062694249354'
lon='0.134404947388109'>
<tag k='amenity' v='cinema'/>
<tag k='name' v='Vue Cinema (multi screen)'/>
<tag k='created_by' v='JOSM'/>
</node>
</osm>


> In terms of how the issue with the 417 error was fixed, you need
> this line:
>
> curl_setopt ($ch, CURLOPT_HTTPHEADER,array("Expect:"));


Excellent - works perfectly, thank you.

How can I tell there has been a conflict with someone else uploadingthe same
node since I downloaded it, as JOSM does?

Thanks for the help,

David





More information about the dev mailing list