-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error fetching responses from OpenStreetMap's "Nominatim" geocoding API #508
Comments
It's definitely more nuanced than that. Per RFC 7230, Section 3.3.2:
If That is definitely not the case, although it seems like there is a bug here. |
@tarcieri Right, fair enough! Thanks for taking a first look so quickly and for making the issue's title better :) |
I was hoping to work out the cause of this one, but I've hit a wall of C, so I'm going to stop there. This is what I've worked out.
I can confirm that reading a second chunk from the socket does return part of the HTTP body. A second read is never attempted, though, because the parser thinks that it is finished. Here is the first chunk (has a newline at the end): HTTP/1.1 200 OK
Date: Tue, 06 Nov 2018 05:11:49 GMT
Server: Apache/2.4.29 (Ubuntu)
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: OPTIONS,GET
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Expect-CT: max-age=0, report-uri="https://openstreetmap.report-uri.com/r/d/ct/reportOnly"
Upgrade: h2
Connection: Upgrade, close
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
1f83 |
To add a bit more, I found this in the
So my current theory is that OpenStreetMap is not supposed to be responding with an Related: https://bz.apache.org/bugzilla/show_bug.cgi?id=59311 |
They are using the HTTP/2-upgrading protocol as specified in RFC 7540, section 3.2:
This seems like a bug in |
This is wrong on many levels. According to the RFC:
It is also wrong in the sense that the client MUST advertise willingness to to upgrade by sending a However, the client must ignore it, as net-http does. It might be a parser's fault, which is a bit serious, as support there seems to have halted. FWIW httpx will be a drop-in replacement for your case and will negotiate HTTP/2 over ALPN: require "httpx"
puts HTTPX.get("https://nominatim.openstreetmap.org/search/canberra") |
I would realy love to see HTTP2 support in HTTP gem. :D |
require "httpx"
HTTP = HTTPX
puts HTTP.get("https://nominatim.openstreetmap.org/search/canberra") done :) |
🤦♂️
PS: Do you really think that this issue tracker is a right place for self-promoting? |
It was a pun, not to be taken seriously. (Most of) the API is similar because I do recognize the ease-of-use of httprb (this is stated in httpx's README, btw). As a side-note, I did try to integrate HTTP/2 functionality in httprb before go "writing my own", but I couldn't make it work. Hopefully you'll succeed where I failed. Now, let's go back to the original topic: |
Got it. But the problem that somebody might think it was serious, take that advice and have a false feeling that HTTP gem is broken (most likely opening an issue as well). :D
United we stand. :D Honestly I'm afraid even to think about getting my hands on that. :D
That's fair point. We have some work ongoing on fixing that. :D |
When I make a request to OpenStreetMap's "Nominatim" geocoding API using the HTTP gem, I receive an erroneously blank response:
Whereas it works fine with net/http (and many other HTTP gems, including Typhoeus)
Other requests with the HTTP gem do work fine, so I can only imagine this is something to do with the response from this particular service. It seems the combination of a
Transfer-Encoding: chunked
header and the absence of aContent-Length
header might have something to do with it? I'm at least led that way by looking through the issues history and finding #45.However, since that issue was closed over 4 years ago, and I'm finding a similar issue with the latest (4.0.0) version of the gem, I thought I should open a new one.
The text was updated successfully, but these errors were encountered: