Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Jan 20, 2015
  1. feat: accepts initialization block

    authored { |c| c.debug_dev = STDERR }.get("...")
Commits on Jan 3, 2015
  1. refactor: do not use Queue#pop in sync request

    Let do_get_block return response object and do_request use it. It still
    has Connection object and call Queue#push for Newrelic gem:
  2. Revert "refactor: do not use Queue#pop in sync request"

    This reverts commit 45b1045 because it
    broke Webmock compatibility.
  3. Merge pull request #237 from nahi/http-cookie

    feat: use http-cookie for better Cookies spec compliance
  4. Recover old cookie implementation as fallback

    http-cookie is used by default but you can restore original
    CookieManager behavior by loading 'httpclient/webagent-cookie' feature
    before 'httpclient' like this;
    require 'httpclient/webagent-cookie'
    require 'httpclient'
Commits on Jan 1, 2015
  1. refactor: do not use Queue#pop in sync request

    Let do_get_block return response object and do_request use it. It still
    has Connection object and call Queue#push for Newrelic gem:
Commits on Dec 31, 2014
Commits on Dec 30, 2014
  1. feat: use http-cookie for better Cookies spec compliance

    Instead of WebAgent 0.6.2 that is not maintained over 10 years. To omit
    maintaining that library use http-cookie for better spec compliance and
    healthy development.
    This introduces following incompatibility from existing cookies
    * Expired cookies are not saved. With the old implementation expired
      cookies are saved in file and not be sent to the server. With the new
      implementation the expired cookies are not saved to the file and not
      be sent to the server.
    * Cookie#url -> Cookie#origin
    * Cookie#domain returns dot-less domain for domain cookies. Instead,
      Cookie#dot_domain returns with dot.
  2. fix: duplicated query params by follow_redirect

    When the original request has query and the server returns redirection
    response with Location, HTTPClient wrongly adds query to the new URI. In
    such case the Location header could include query part;
      -> Location: http://otherhost/api/call?limit=10
    HTTPClient should just hit the new location '/api/call?limit=10' not
    '/api/call?limit=10&limit=10'. Closes #236.
Commits on Dec 28, 2014
  1. fix: transplant IO positions to new request in negotiation

    In authorization negotiation HTTP::Message for request is generated for
    each request, of course, but HTTPClient didn't care the IO position
    recorded in the previous requests in the subsequent requests.
    Closes #130.
  2. feat: Message#previous to get responses in negotiation

    HTTP::Message#previous keeps previous response in negotiation.  For
    redirection, authorization negotiation and retry from custom filter.
    Closes #234.
Commits on Nov 17, 2014
  1. Fix KeepAliveDisconnected race condition

    As details explained in #84, current HTTPClient's KeepAliveDisconnected
    handling has a race condition bug that allows a client to have
    invalidated connection two or more times. This could be a cause of #185.
    To avoid this, make HTTPClient acquire new connection for retry of
    Closes #84. Closes #185.
Commits on Nov 5, 2014
  1. Revert "Do not use persistent connection for POST and PUT"

    This reverts commit a19408a.
Commits on Nov 3, 2014
  1. Do not use persistent connection for POST and PUT

    It could cause duplicated POST or PUT by connection reset while
    processing.  Do not use persistent connection for POST and PUT, and also
    do not retry when it detects connection failure.
    Closes #142.
  2. Allow no content POST and PUT

    Previously POST or PUT with :body => nil meant that 'POST or PUT with 0
    length entity body'. But sometimes you need to POST or PUT actually no
    content which should not have Content-Type nor Content-Length.
    It could be incompatible change for user who POST/PUT-ed with empty body
    but it should be rare, actually WEBrick cannot handle such 'no content'
    POST and PUT.
    Closes #128.
Commits on Oct 30, 2014
  1. Add default_header property

    :default_header is for providing default headers Hash that all HTTP
    requests should have, such as custom 'Authorization' header in API.  You
    can override :default_header with :header Hash parameter in HTTP request
Commits on Oct 28, 2014
  1. Merge branch 'dont-use-special-variable' of…

    …32/httpclient into takano32-dont-use-special-variable
Commits on Oct 21, 2014
Commits on Oct 20, 2014
  1. Add :base_url to HTTPClient configuration

    api = => '')
    api.get("/users.json") # => Get
    api.get("https://localhost/path") # => https://localhost/path
    Passing path to get, post, etc. is recognized as a request to
    :base_url + uri.  If you pass full URL :base_url is ignored.
Commits on Oct 19, 2014
  1. Add :force_basic_auth config

    Generally HTTP client must send Authorization header after it gets 401
    error from server from security reason. But in some situation (e.g.
    API client) you might want to send Authorization from the beginning.
    You can turn on/off force_basic_auth flag for sending Authorization
    header from the beginning. (Of cource, if a request URI matches with
    the URI you set in set_auth method)
    Syntax: => true)
      c =
      c.force_basic_auth = true
    Closes #166, #179, #181.
  2. Refactoring of (head|get)_async

    As same as other methods.
Commits on Oct 18, 2014
  1. Allow post and put accepts :query parameter

    Code looks weird but needed. To keep compatibility,
      post('http://localhost/', :query => query)
    is a POST method WITHOUT query and with "query=query" BODY. Now
    HTTPClient accepts :query parameter if :body parameter given with it.
      post('http://localhost/', :query => query, :body => body)
    is a POST method to http://localhost/?query with 'body' as message-body.
    Closes #83.
    Also this commit simplifies argument handling so that we can keep
    post/post_content/post_async in sync.
  2. Make delete and options accept :query argument

    If user passes only :query in the argument, delete method parses it as a
    body and options method parses it as a header. Closes #136
  3. Allow to pass :body to options method

    httpclient.options(url, :body => ...)
    Closes #215
Commits on Oct 16, 2014
  1. Keep cause error of KeepAliveDisconnected

    Allow caller to investigate the cause of KeepAliveDisconnected.
Commits on Jun 7, 2014
Commits on May 21, 2014
  1. Merge pull request #194 from idibon/multi-parameter-blocks

    Allow blocks for request function to retrieve the response object
  2. Avoid chunked String recycle in block style

    This bug happend when;
     - Transfer-Encoding: chunked
     - Block style API; get(...) { |chunked| ... }
    Buggy behavior; String 'chunked' is overwritten for each block call.
    This bug is introduced in 2.3.4.  Thanks for finding this, @brendandc.
    Fixes #193
Commits on Feb 24, 2013
  1. Add User-Agent header by default. Closes #144.

    You can remove User-Agent header by setting nil to
Commits on Oct 9, 2012
  1. Addressable gem support (only if it exists)

    It wraps Addressable::URI for subtle URI compatibilities that httpclient
Commits on Oct 7, 2012
  1. Handle '303 See Other' properly

    RFC2616 says it should be redirected with GET.
Commits on Sep 22, 2012
  1. Followup fix for leading dot in no_proxy

     * '' in no_proxy should match with '';
     * '' in no_proxy should not match with ''
    cf. e2bf6a0
Commits on Aug 11, 2012
Something went wrong with that request. Please try again.