I have a lot of software running on an embedded system with ruby 1.8.6. One script queries the national weather service and a few days ago it stopped working: I started getting <H1>Access Denied</H1>
. This is a public interface and there's no API key.
I get the same error when I run this script using ruby 1.8.6 on my development machine. When I run it with ruby 1.9, the error doesn't happen.
Evidently the NWS modified their HTTP protocol in some way last week that is incompatible with Net:HTTP in ruby 1.8.6
I get a good response when I use curl.
The code is:
begin
xml = Net::HTTP.get_response(URI.parse(url)).body
rescue
I have RestClient 1.6 and tried substituting that for Net:HTTP but it just uses Net:HTTP internally and I get a 403 Forbidden
.
Does anyone have any idea what could have changed in the protocol and a way to work around it?
I think I may be able to get updated firmware from the system manufacturer but I hesitate to go that route because it will force rewriting of many rather fragile hacks.