Errors when connecting to HTTPS using HTTP::Net routines (Ruby on Rails)
- by jaycode
Hi all,
the code below explains the problem in detail
#this returns error Net::HTTPBadResponse
url = URI.parse('https://sitename.com')
response = Net::HTTP.start(url.host, url.port) {|http|
http.get('/remote/register_device')
}
#this works
url = URI.parse('http://sitename.com')
response = Net::HTTP.start(url.host, url.port) {|http|
http.get('/remote/register_device')
}
#this returns error Net::HTTPBadResponse
response = Net::HTTP.post_form(URI.parse('https://sitename.com/remote/register_device'), {:text => 'hello world'})
#this returns error Errno::ECONNRESET (Connection reset by peer)
response = Net::HTTP.post_form(URI.parse('https://sandbox.itunes.apple.com/verifyReceipt'), {:text => 'hello world'})
#this works
response = Net::HTTP.post_form(URI.parse('http://sitename.com/remote/register_device'), {:text => 'hello world'})
So... how do I send POST parameters to https://sitename.com or https://sandbox.itunes.apple.com/verifyReceipt in this example?
Further information, I am trying to get this working in Rails: http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html#//apple_ref/doc/uid/TP40008267-CH104-SW1