Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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

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

    authored
    Let do_get_block return response object and do_request use it. It still
    has Connection object and call Queue#push for Newrelic gem:
    https://github.com/newrelic/rpm/blob/master/lib/new_relic/agent/instrumentation/httpclient.rb#L34-L36
  2. Revert "refactor: do not use Queue#pop in sync request"

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

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

    authored
    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

    authored
    Let do_get_block return response object and do_request use it. It still
    has Connection object and call Queue#push for Newrelic gem:
    https://github.com/newrelic/rpm/blob/master/lib/new_relic/agent/instrumentation/httpclient.rb#L34-L36
Commits on Dec 31, 2014
Commits on Dec 30, 2014
  1. feat: use http-cookie for better Cookies spec compliance

    authored
    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
    implementation.
    * 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

    authored
    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;
    
    e.g.
      http://originalhost/api/call?limit=10
      -> 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

    authored
    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

    authored
    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

    authored
    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
    KeepAliveDisconnected.
    
    Closes #84. Closes #185.
Commits on Nov 5, 2014
  1. Revert "Do not use persistent connection for POST and PUT"

    authored
    This reverts commit a19408a.
    
    Conflicts:
    	lib/httpclient/session.rb
Commits on Nov 3, 2014
  1. Do not use persistent connection for POST and PUT

    authored
    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

    authored
    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

    authored
    :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
    methods.
Commits on Oct 28, 2014
  1. Merge branch 'dont-use-special-variable' of https://github.com/takano…

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

    authored
    api = HTTPClient.new(:base_url => 'https://api.example.com/v1')
    api.get("/users.json") # => Get https://api.example.com/v1/users.json
    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

    authored
    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:
      HTTPClient.new(:force_basic_auth => true)
    or
      c = HTTPClient.new
      c.force_basic_auth = true
    
    Closes #166, #179, #181.
  2. Refactoring of (head|get)_async

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

    authored
    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

    authored
    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

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

    authored
    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

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

    authored
    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.

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

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

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

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