322 Commits

Author SHA1 Message Date
Dor Shahaf
31b7ce5488 Add setting of SSL version to http_persistent and typhoeus 2012-04-12 19:04:38 +03:00
Dor Shahaf
5cbfd2cdbf Allow setting of ssl version 2012-04-11 20:03:50 +03:00
Hiten Parmar
8d7ccc1ecb Add message to readme. 2012-04-07 11:13:22 -07:00
Erik Michaels-Ober
204d7c46a8 Merge pull request #130 from ezkl/feature/add-patron-proxy-support
Add HTTP proxy support to Patron adapter
2012-04-05 16:15:05 -07:00
Ezekiel Templin
d89952cebc Cleanup Patron proxy integration 2012-04-01 15:14:26 -04:00
Ezekiel Templin
5facefebd9 Add HTTP proxy support to Patron adapter 2012-04-01 13:21:25 -04:00
Nathaniel Bibler
3cb8fb21ff Wrap known exceptions which bubble up through Net::HTTP 2012-03-29 15:34:26 -04:00
Dimitrij Denissenko
f70e6bf067 Catch Errno::ETIMEDOUT too 2012-03-05 18:18:10 +00:00
Dimitrij Denissenko
28842e042e Added Net::HTTP::Persistent adapter 2012-03-02 17:57:07 +00:00
Hiten Parmar
5f635a293d Only handle block if block_given?. 2012-02-12 23:52:46 -08:00
Hiten Parmar
b0b1e38607 Reuse session between requests on a single Faraday::Connection. 2012-02-12 15:06:02 -08:00
Hiten Parmar
1d6e2ace2f Add ability to set options on Patron Session object.
Example:

  Faraday.new(:url => url) do |conn|
    conn.adapter :patron do |session|
      session.handle_cookies
    end
  end
2012-02-12 14:50:40 -08:00
Mislav Marohnić
4ce1bc511a Release 0.8.0.rc2 2012-01-29 00:08:18 +01:00
Mislav Marohnić
aec0723735 fix Utils::Headers 2012-01-29 00:06:34 +01:00
Mislav Marohnić
562fb16ff9 Release 0.8.0.rc 2012-01-28 23:10:39 +01:00
Mislav Marohnić
3a2420389b have Connection#in_parallel warn if no parallel support 2012-01-28 22:57:49 +01:00
Mislav Marohnić
0a9413839a have EMHttp handle Errno::ECONNREFUSED error 2012-01-28 22:57:49 +01:00
Mislav Marohnić
97b24b9878 fix EMHttp and Typhoeus request timeout implementations 2012-01-28 22:57:49 +01:00
Mislav Marohnić
2c1f8b1d7f EMSynchrony patch, options methods 2012-01-28 22:57:49 +01:00
Mislav Marohnić
b047064568 add EventMachine adapter 2012-01-28 22:57:49 +01:00
Mislav Marohnić
4878051c30 rename Adapter method to supports_parallel? 2012-01-28 22:57:30 +01:00
Jim Myhrberg
32ecd07c27 enable automatic parallel manager detection
This enables the use of `#in_parallel` without manually passing in a
parallel manager instance.

If the adapter you're using has a parallel manager, it will work as
expected. If it doesn't, it'll work as normal sequential requests.
2012-01-28 22:57:21 +01:00
Mislav Marohnić
085ee735dc Improve how params, headers & options are handled in the request phase
Old behavior:

  # init connection with some defaults:
  conn = Faraday.new :params => {...}, :request => {...}

  conn.get('/') do |request|
    request.params = {...}   # params got merged with defaults
    request.options = {...}  # options got deep-merged with defaults
  end

New behavior:

  conn.get('/', {...}) do |request|
    request.params.update(...)  # merge with existing params
    request.params = {...}      # replace all existing params

    request.options[:proxy][:user] = "..." # add extra request options:
    request.options = {...}                # replace all existing options
  end

Pros of the new behavior are consistency, ability to completely override
parameters per-request. Cons are breaking backwards-compatibility.
2012-01-28 22:14:59 +01:00
Harry Marr
8e5fd53926 support nested params in the URL query string 2012-01-28 22:09:37 +01:00
Mislav Marohnić
394c62cd36 raise exception if initializing middleware with missing dependencies
Previously it would just try to use the middleware and it would result
in unexplained errors when making requests.
2012-01-24 22:56:16 +01:00
Mislav Marohnić
86925fd5d5 eliminate Ruby warnings 2012-01-19 16:07:09 +01:00
Larry Marburger
0891299330 refactor Typhoeus adapter into smaller methods 2012-01-11 20:17:05 +01:00
Larry Marburger
95b987feb6 fix build_url to accept URI instance 2012-01-11 20:02:24 +01:00
Mislav Marohnić
14ee662e25 add additional 2nd arg to get/head/delete(): a query params hash
This is backwards-incompatible.

The signature for these methods was:
  (url, headers)

Now it is:
  (url, params, headers)

The params hash adds values to the query string of the request.

Closes #88
2012-01-06 15:14:21 +01:00
Mislav Marohnić
7f0cd872e6 remove hacks when conditionally forwarding blocks in methods
Yes, named blocks (Procs) in methods are slow in Ruby. This is because
of unfortunate performance penalty of instantiating and
garbage-collecting these Proc objects, which happens even if we never
use or even pass a block to the method. Certain methods in Faraday were
optimized to avoid named blocks.

This removes such optimizations. The rationale is that the performance
penalty of named blocks is negligible to the overhead of HTTP requests
over the network.
2012-01-06 13:48:37 +01:00
Mislav Marohnić
445152b164 escape square brackets in keys for nested query strings
Closes #82
2012-01-02 19:23:50 +01:00
Mislav Marohnić
a81b7052cc add Faraday.register_middleware
Allows 3rd-party libraries to register named shortcuts to resolve to
fully qualified constant names for specific middleware.

Usage:
  Faraday.register_middleware :aloha => MyModule::Aloha
  Faraday.register_middleware :response, :boom => MyModule::Boom
  Faraday.register_middleware :lazy => lambda { MyModule::LazyLoaded }

Those shortcuts are then available in Builder:
  builder.use :aloha
  builder.response :boom
2012-01-02 15:47:52 +01:00
Mislav Marohnić
66fba21722 enable GET requests with body in Patron
They are still unsupported in Patron itself because of
https://github.com/toland/patron/issues/52
2011-12-30 17:13:08 +01:00
Jiren Patel
6aecc5de6c enable GET requests with body for Net::HTTP adapter 2011-12-30 17:06:45 +01:00
Mislav Marohnić
8f7f6694da remove dependency on Addressable::URI
This is a potentially breaking change for 3rd party code that relies on
env[:url] being specifically Addressable. After this change all urls are
passed around as instances of URI::HTTP.
2011-12-30 15:08:14 +01:00
Mislav Marohnić
125c50fded Connection.new yields self after everything has been set up 2011-12-30 02:40:24 +01:00
Mislav Marohnić
9830fdb137 Connection.new with block yields self, not builder instance
This allows:
  Faraday.new {|f| f.url_prefix = '...' }

Backwards compatibility is kept for the most part because main Builder
methods `use`, `request`, `response` and `adapter` are already forwarded
from Connection:

  # will function as before:
  Faraday.new {|f| f.adapter :net_http }
2011-12-30 00:35:59 +01:00
Mislav Marohnić
f8b578ee53 rename basic/token_authentication to "basic/token_auth"
The symbols for middleware are supposed to be shortcuts; they don't need
to be full names of corresponding classes.
2011-12-29 14:29:34 +01:00
Mislav Marohnić
db554b2926 remove JSON request middleware 2011-12-29 14:22:07 +01:00
Erik Michaels-Ober
497ccdec8a Merge pull request #100 from technoweenie/no-rack
Removed Rack dependency
2011-12-28 17:27:08 -08:00
rick
bb507e4578 only insert the faraday root path for faraday files 2011-12-28 18:23:11 -07:00
Mislav Marohnić
8806c4ff46 use escape/unescape from CGI 2011-12-29 02:22:07 +01:00
Mislav Marohnić
0d517cda5f remove Rack dependency 2011-12-29 02:01:05 +01:00
Mislav Marohnić
fdabbc1b29 fix HEAD requests with Net:HTTP
Net::HTTP on Ruby 1.9.3p0 would spend insane amount of time (~30s) per
request waiting to get response body from a HEAD request.
2011-12-29 01:56:56 +01:00
rick
d0df9abfb0 merrrrrge 2011-12-28 15:03:40 -07:00
rick
e641735706 Merge branch 'feature/em_synchrony_parallel' of https://github.com/jimeh/faraday into jimeh-feature/em_synchrony_parallel 2011-12-28 14:45:50 -07:00
rick
ed64a91de4 test patron and net/http timeouts 2011-12-28 14:37:38 -07:00
rick
43343e971f remove timeout middleware 2011-12-28 13:53:00 -07:00
rick
a928ee53ad merge readme changes 2011-12-28 13:44:22 -07:00
Erik Michaels-Ober
c926020259 Explicitly require CGI 2011-12-28 10:28:25 -08:00