| # API v1.1, HTTPS | |
| # Expected: {\"errors\":[{\"message\":\"Bad Authentication data\",\"code\":215}]} | |
| # Raises: EOFError: end of file reached | |
| require 'net/http' | |
| uri = "https://api.twitter.com/1.1/users/show.json?user_id=33978" | |
| Net::HTTP.get(URI(uri)) | |
| # API v1, HTTPS | |
| # Expected: {\"errors\":[{\"message\":\"Bad Authentication data\",\"code\":215}]} | |
| # Raises: EOFError: end of file reached | |
| require 'net/http' | |
| uri = "https://api.twitter.com/1/users/show.json?user_id=33978" | |
| Net::HTTP.get(URI(uri)) | |
| # API v1.1, HTTP | |
| # Expected: {\"errors\":[{\"message\":\"Bad Authentication data\",\"code\":215}]} | |
| # Returns: {\"errors\":[{\"message\":\"Bad Authentication data\",\"code\":215}]} | |
| require 'net/http' | |
| uri = "http://api.twitter.com/1.1/users/show.json?user_id=33978" | |
| Net::HTTP.get(URI(uri)) | |
| # API v1.0, HTTP | |
| # Expected: {\"errors\":[{\"message\":\"Bad Authentication data\",\"code\":215}]} | |
| # Returns: {\"errors\":[{\"message\":\"Bad Authentication data\",\"code\":215}]} | |
| require 'net/http' | |
| uri = "http://api.twitter.com/1/users/show.json?user_id=33978" | |
| Net::HTTP.get(URI(uri)) |
This comment has been minimized.
This comment has been minimized.
kurrik
commented
Mar 20, 2013
|
I'm trying to figure out what Ruby is doing to send the request. I was able to get the following to work:
Note that I'm setting up a proxy using mitmproxy to capture the request. Interestingly, the difference between the request from the snippet above and the failing first example is that the working example sends:
But the failing ruby test sends:
Note the http/https difference. It seems like Ruby is sending a non-HTTPS request to api.twitter.com:443 and just getting rejected at the SSL handshake part of the request. Any idea of anything which may have changed recently with regard to how Net::HTTP sends requests? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
sferik commentedMar 20, 2013
Notes
1.8.7-p371,1.9.2-p320, and1.9.3-p392but not2.0.0-p0.user_id=33978).