Error when checking user status

ildar.abdulin's Avatar

ildar.abdulin

19 May, 2011 11:41 AM

I receive status code when I paste url in browser, but when I try to do
status = Net::HTTP.get_response(URI.parse("https://mysite.chargevault.com/status?key=key&code=code")).body

I receive this error:

Net::HTTPBadResponse: wrong status line: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">"

/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:2221:in `read_status_line'
/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:2208:in `read_new'
/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:1191:in `transport_request'
/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:1177:in `request'
  1. Support Staff 1 Posted by Marc Guyer on 19 May, 2011 02:48 PM

    Marc Guyer's Avatar

    Hi Ildar -- Can you tell what the raw response is?

  2. Support Staff 2 Posted by Marc Guyer on 19 May, 2011 04:25 PM

    Marc Guyer's Avatar

    I guess that bit of code was untested. It turns out to be much more involved because of the ssl:

    uri = URI.parse("https://yoursite.chargevault.com/status?key=a1b2c3d4e6&code=yourcustomercode")
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    request = Net::HTTP::Get.new(uri.request_uri)
    status = http.request(request).body
    
  3. 3 Posted by ildar.abdulin on 20 May, 2011 01:22 AM

    ildar.abdulin's Avatar

    Problem solved,
    Thank you!

  4. Marc Guyer closed this discussion on 20 May, 2011 03:27 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM