This post originated from an RSS feed registered with Ruby Buzz
by Eric Hodel.
Original Post: Proposal: Net::HTTP user-agent class for Ruby stdlib
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
I have proposed adding a new class to Ruby's standard library that makes Net::HTTP easier to use. You can read my HTTP user-agent class proposal on redmine.
The first question is not "What should the API look like?" but "Should it be in the standard library?". My argument is this:
I have had discussions where people say "Net::HTTP's API is not very good" and people seem to want a better way to use Net::HTTP without trying out one of the many Net::HTTP::Agent-like extensions to the base API.
Having a recommended way to perform HTTP access in ruby will be useful to the community since they don't have to do any additional research. Also users will be able perform basic HTTP requests for multiple servers and will gain the efficiencies of persistent connections without extra work.
The biggest issue people have is that they need to pass the host, port and SSL params for every HTTP connection made. The nature of the API means that most people make a new connection for every request. Since this is confusing for new users and annoying for experienced users I think it should be addressed in stdlib.
Do you think a smoother API for performing HTTP requests would be useful in Ruby's standard library? If you do (or don't) I'd appreciate further discussion on the ticket.