Bug #5545

Net::HTTP breaks with https URI objects

Added by Mark Ferlatte almost 4 years ago. Updated almost 4 years ago.

[ruby-core:40665]
Status:Closed
Priority:Normal
Assignee:Eric Hodel
ruby -v:ruby 2.0.0dev (2011-10-25 trunk 33524) [i686-linux] Backport:

Description

uri = URI('https://example.com/index.html?count=10')
Net::HTTP.get(uri)

will currently fail with an obscure error due to Net::HTTP attempting to speak HTTP to an HTTPS service.

I believe this is a bug, and have patched lib/net/http.rb to use SSL when you use an https URI with the get and post_form helpers.

http.rb.diff Magnifier (797 Bytes) Mark Ferlatte, 11/04/2011 06:13 AM

Associated revisions

Revision 33849
Added by Yui NARUSE almost 4 years ago

  • lib/net/http.rb (Net::HTTP.get_response): enable use_ssl
    if given URI object is https.
    patched by Mark Ferlatte [Bug #5545]

  • lib/net/http.rb (Net::HTTP.post_form): ditto.

Revision 33849
Added by Yui NARUSE almost 4 years ago

  • lib/net/http.rb (Net::HTTP.get_response): enable use_ssl
    if given URI object is https.
    patched by Mark Ferlatte [Bug #5545]

  • lib/net/http.rb (Net::HTTP.post_form): ditto.

History

#1 Updated by Mark Ferlatte almost 4 years ago

#2 Updated by Mark Ferlatte almost 4 years ago

Sorry, apparently failed to attach the patch to the bug. Please let me know if there's anything I should change in order for this patch to be accepted.

#3 Updated by Martin Bosslet almost 4 years ago

  • Assignee set to Eric Hodel
  • Target version set to 2.0.0
  • Status changed from Open to Assigned

Thanks, Mark, for reporting this and providing the patch.

As far as I know, Eric is working on a fix for this problem, too?

#4 Updated by Mark Ferlatte almost 4 years ago

That would be awesome. I saw bugs from Eric about SSL session re-use in Net::HTTP, but didn't see anything about this particular issue.

#5 Updated by Yui NARUSE almost 4 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r33849.
Mark, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/net/http.rb (Net::HTTP.get_response): enable use_ssl
    if given URI object is https.
    patched by Mark Ferlatte [Bug #5545]

  • lib/net/http.rb (Net::HTTP.post_form): ditto.

Also available in: Atom PDF