Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

GPX upload through API fails with content-type and encodings #3513

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 3 comments
Closed

Comments

@openstreetmap-trac
Copy link

Reporter: rcgroot[at]gmail.com
[Submitted to the original trac issue database at 5.29am, Saturday, 5th February 2011]

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

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 5.35pm, Saturday, 5th February 2011]

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.

@openstreetmap-trac
Copy link
Author

Author: rcgroot[at]gmail.com
[Added to the original trac issue at 7.37pm, Saturday, 5th February 2011]

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

@openstreetmap-trac
Copy link
Author

Author: rcgroot[at]gmail.com
[Added to the original trac issue at 8.22pm, Saturday, 5th February 2011]

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant