httpclient
HTTPClient is a Ruby gem that provides a simple and flexible interface for making HTTP requests. It's a full-featured HTTP client library with support for cookies, redirects, proxy, and more. It's built on top of the libwww-perl library, which is a widely-used, robust and well-documented library.
Features:
- methods like GET/HEAD/POST/* via HTTP/1.1.
- HTTPS(SSL), Cookies, proxy, authentication(Digest, NTLM, Basic), etc.
- asynchronous HTTP request, streaming HTTP request.
- debug mode CLI.
- by contrast with net/http in standard distribution;
- Cookies support
- MT-safe
- streaming POST (POST with File/IO)
- Digest auth
- Negotiate/NTLM auth for WWW-Authenticate (requires net/ntlm module; rubyntlm gem)
- NTLM auth for Proxy-Authenticate (requires 'win32/sspi' module; rubysspi gem)
- extensible with filter interface
- you don't have to care HTTP/1.1 persistent connection (httpclient cares instead of you)
Example Use
require 'httpclient'
client = HTTPClient.new
# GET requests
response = client.get("http://httpbin.org/get")
puts response.content
# POST requests
data = { name: "value" }
response = client.post("http://httpbin.org/post", data)
puts response.content