Opened 8 years ago

Closed 8 years ago

#3513 closed defect (worksforme)

GPX upload through API fails with content-type and encodings

Reported by: rcgroot@… Owned by: Tom Hughes
Priority: major Milestone: OSM 0.6
Component: api Version:
Keywords: gpx upload Cc:

Description

I'm uploading GPX files to the dev server using Apache httpclient-4.1.jar and am receiving unclear errors and HTTP-500 status.

Executing the same upload with a perl script succeeds. Tracing the procedure with Wireshark shows only a major difference in the added Content-Type and Content-Transfer-Encoding in the Mime entities.

Attached the network traces to api06.dev.openstreetmap.org using Java and Perl.

Thank for lookin into this. Rene

Working on Android Open GPS Tracker, Direct upload to OpenStreetMap http://code.google.com/p/open-gpstracker/issues/detail?id=194 Lines 469-538 http://code.google.com/p/open-gpstracker/source/browse/trunk/OpenGPSTracker/trunk/application/src/nl/sogeti/android/gpstracker/actions/ShareTrack.java?r=816

Attachments (2)

java_stream.txt (10.0 KB) - added by rcgroot@… 8 years ago.
Network sniff of Java code uploading and failing
perl_stream.txt (9.4 KB) - added by rcgroot@… 8 years ago.
Network sniff of Perl code uploading and succeeding

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by rcgroot@…

Attachment: java_stream.txt added

Network sniff of Java code uploading and failing

Changed 8 years ago by rcgroot@…

Attachment: perl_stream.txt added

Network sniff of Perl code uploading and succeeding

comment:1 Changed 8 years ago by Tom Hughes

This appears to be an issue with rack - it treats any field in a multipart/form-data submission which has a content-type as a file which confuses the upload code which only expects the actual GPX data to be a file.

It looks like it is fixed in rack 1.2.1 but rails 2 still uses 1.1.0 so we're probably stuck with this until we can manage to go to rails 3.

comment:2 Changed 8 years ago by rcgroot@…

Okay, thanks for clearing that up. I'll adjust the upload on the client side.

comment:3 Changed 8 years ago by rcgroot@…

Resolution: worksforme
Status: newclosed

http-client offers a quick fix client-side: A constructor parameter allows httpclient changes the behavior as desired.

new MultipartEntity?(HttpMultipartMode?.BROWSER_COMPATIBLE); http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html

Note: See TracTickets for help on using tickets.