http 0.6.4 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of http might be problematic. Click here for more details.

Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +38 -93
  3. data/.travis.yml +5 -5
  4. data/.yardopts +2 -0
  5. data/CHANGES.md +21 -5
  6. data/Gemfile +12 -9
  7. data/Guardfile +3 -4
  8. data/LICENSE.txt +1 -1
  9. data/README.md +76 -53
  10. data/Rakefile +1 -1
  11. data/examples/parallel_requests_with_celluloid.rb +1 -1
  12. data/http.gemspec +6 -5
  13. data/lib/http.rb +0 -1
  14. data/lib/http/chainable.rb +54 -20
  15. data/lib/http/client.rb +14 -12
  16. data/lib/http/headers.rb +20 -17
  17. data/lib/http/mime_type/adapter.rb +1 -1
  18. data/lib/http/options.rb +1 -1
  19. data/lib/http/request.rb +23 -16
  20. data/lib/http/request/writer.rb +2 -7
  21. data/lib/http/response.rb +47 -76
  22. data/lib/http/response/body.rb +2 -3
  23. data/lib/http/response/status.rb +122 -0
  24. data/lib/http/response/status/reasons.rb +72 -0
  25. data/lib/http/version.rb +1 -1
  26. data/logo.png +0 -0
  27. data/spec/http/client_spec.rb +13 -47
  28. data/spec/http/content_type_spec.rb +15 -15
  29. data/spec/http/headers/mixin_spec.rb +1 -1
  30. data/spec/http/headers_spec.rb +42 -38
  31. data/spec/http/options/body_spec.rb +1 -1
  32. data/spec/http/options/form_spec.rb +1 -1
  33. data/spec/http/options/headers_spec.rb +2 -2
  34. data/spec/http/options/json_spec.rb +1 -1
  35. data/spec/http/options/merge_spec.rb +1 -1
  36. data/spec/http/options/new_spec.rb +2 -2
  37. data/spec/http/options/proxy_spec.rb +1 -1
  38. data/spec/http/options_spec.rb +1 -1
  39. data/spec/http/redirector_spec.rb +1 -1
  40. data/spec/http/request/writer_spec.rb +72 -24
  41. data/spec/http/request_spec.rb +31 -35
  42. data/spec/http/response/body_spec.rb +1 -1
  43. data/spec/http/response/status_spec.rb +139 -0
  44. data/spec/http/response_spec.rb +7 -7
  45. data/spec/http_spec.rb +41 -37
  46. data/spec/spec_helper.rb +2 -10
  47. data/spec/support/example_server.rb +14 -86
  48. data/spec/support/example_server/servlet.rb +102 -0
  49. metadata +46 -21
  50. data/lib/http/authorization_header.rb +0 -37
  51. data/lib/http/authorization_header/basic_auth.rb +0 -24
  52. data/lib/http/authorization_header/bearer_token.rb +0 -28
  53. data/lib/http/backports.rb +0 -2
  54. data/lib/http/backports/base64.rb +0 -6
  55. data/lib/http/backports/uri.rb +0 -131
  56. data/spec/http/authorization_header/basic_auth_spec.rb +0 -29
  57. data/spec/http/authorization_header/bearer_token_spec.rb +0 -36
  58. data/spec/http/authorization_header_spec.rb +0 -41
  59. data/spec/http/backports/base64_spec.rb +0 -13
  60. data/spec/http/backports/uri_spec.rb +0 -9
  61. data/spec/support/black_hole.rb +0 -5
  62. data/spec/support/create_certs.rb +0 -57
  63. data/spec/support/dummy_server.rb +0 -52
  64. data/spec/support/dummy_server/servlet.rb +0 -30
  65. data/spec/support/servers/config.rb +0 -13
  66. data/spec/support/servers/runner.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4030eeaf2d60cda70af573153fe436493061181
4
- data.tar.gz: 8c81614a50e7510eb06a0b48ddd8b140da557b88
3
+ metadata.gz: bc19474bee4f52564c7c3e7da6a3223aa9854a1e
4
+ data.tar.gz: 9f6d3dcf7a3ed0bedd9de9ae38fee5d4cba2f40b
5
5
  SHA512:
6
- metadata.gz: 71658b9dc31eb01d62e038c6f7a4e193aa030360ad65d146a5fa3ab03c563c163b9fd688f9a2496b640a143f3658a21b74bc791301b701aaa4c972250995c608
7
- data.tar.gz: 59254dd112aa7e6405b56ddc5901c564d942fdd8e12e913e1a4b6b1f64faf79257432ad85f4b6385b8b4a3f8b45ce732e36839fc78ac53f91bf9cd2bce5f66de
6
+ metadata.gz: c5521514cdfa5e30a2e876d492b0ee4d3be1689f0f26fe9258d6c86e6b08ee71521763902042a7ecf2512daf2da6ddd346f84f0c92a9baf9d9c815eb1bac8f57
7
+ data.tar.gz: e1976feb1290b9466bf9de7ffa5050163aac481a88df2557d468d42cc7e2218fd34c202cec47247f008ab3c5c54024c61ba52cd3fadbee1fa064424cdddf1929
@@ -1,116 +1,61 @@
1
- AllCops:
2
- Include:
3
- - 'Gemfile'
4
- - 'Rakefile'
5
- - 'http.gemspec'
6
-
7
- # Avoid long parameter lists
8
- ParameterLists:
9
- Max: 3
10
- CountKeywordArgs: true
1
+ Metrics/BlockNesting:
2
+ Max: 2
11
3
 
12
- MethodLength:
4
+ Metrics/ClassLength:
13
5
  CountComments: false
14
- Max: 31 # TODO: lower to 15
6
+ Max: 100
15
7
 
16
- ClassLength:
17
- CountComments: false
18
- Max: 110
8
+ Metrics/CyclomaticComplexity:
9
+ Max: 8 # TODO: Lower to 6
19
10
 
20
- CyclomaticComplexity:
21
- Max: 13 # TODO: lower to 6
11
+ Metrics/LineLength:
12
+ AllowURI: true
13
+ Max: 143 # TODO: Lower to 80
22
14
 
23
- # Avoid more than `Max` levels of nesting.
24
- BlockNesting:
15
+ Metrics/MethodLength:
16
+ CountComments: false
17
+ Max: 22 # TODO: Lower to 15
18
+
19
+ Metrics/ParameterLists:
25
20
  Max: 3
21
+ CountKeywordArgs: true
26
22
 
27
- # Do not force public/protected/private keyword to be indented at the same
28
- # level as the def keyword. My personal preference is to outdent these keywords
29
- # because I think when scanning code it makes it easier to identify the
30
- # sections of code and visually separate them. When the keyword is at the same
31
- # level I think it sort of blends in with the def keywords and makes it harder
32
- # to scan the code and see where the sections are.
33
- AccessModifierIndentation:
34
- Enabled: false
23
+ Style/AccessModifierIndentation:
24
+ EnforcedStyle: outdent
35
25
 
36
- # Limit line length
37
- LineLength:
38
- Enabled: false
26
+ Style/CollectionMethods:
27
+ PreferredMethods:
28
+ collect: 'map'
29
+ reduce: 'inject'
30
+ find: 'detect'
31
+ find_all: 'select'
39
32
 
40
- # Disable documentation checking until a class needs to be documented once
41
- Documentation:
33
+ Style/Documentation:
42
34
  Enabled: false
43
35
 
44
- # Not all trivial readers/writers can be defined with attr_* methods
45
- TrivialAccessors:
46
- Enabled: false
36
+ Style/DotPosition:
37
+ EnforcedStyle: leading
47
38
 
48
- # Enforce Ruby 1.8-compatible hash syntax
49
- HashSyntax:
50
- EnforcedStyle: hash_rockets
51
-
52
- # No spaces inside hash literals
53
- SpaceInsideHashLiteralBraces:
54
- EnforcedStyle: no_space
55
-
56
- # Allow dots at the end of lines
57
- DotPosition:
39
+ Style/DoubleNegation:
58
40
  Enabled: false
59
41
 
60
- # Don't require magic comment at the top of every file
61
- Encoding:
42
+ Style/EachWithObject:
62
43
  Enabled: false
63
44
 
64
- # Enforce outdenting of access modifiers (i.e. public, private, protected)
65
- AccessModifierIndentation:
66
- EnforcedStyle: outdent
67
-
68
- EmptyLinesAroundAccessModifier:
69
- Enabled: true
70
-
71
- # Align ends correctly
72
- EndAlignment:
73
- AlignWith: variable
45
+ Style/Encoding:
46
+ Enabled: false
74
47
 
75
- # Indentation of when/else
76
- CaseIndentation:
77
- IndentWhenRelativeTo: end
78
- IndentOneStep: false
48
+ Style/HashSyntax:
49
+ EnforcedStyle: hash_rockets
79
50
 
80
- # Use the old lambda literal syntax
81
- Lambda:
51
+ Style/Lambda:
82
52
  Enabled: false
83
53
 
84
- DoubleNegation:
54
+ Style/SingleSpaceBeforeFirstArg:
85
55
  Enabled: false
86
56
 
87
- PercentLiteralDelimiters:
88
- PreferredDelimiters:
89
- '%': ()
90
- '%i': ()
91
- '%q': ()
92
- '%Q': ()
93
- '%r': '{}'
94
- '%s': ()
95
- '%w': '[]'
96
- '%W': '[]'
97
- '%x': ()
98
-
99
- Semicolon:
100
- Exclude:
101
- - 'spec/support/'
102
-
103
- # Do not force first argument to be separated with exactly single space.
104
- # My (ixti) personal preference is to align code in columns when it makes
105
- # sense:
106
- #
107
- # module HTTP
108
- # module MimeType
109
- # class JSON < Adapter
110
- # register_adapter 'application/json', JSON
111
- # register_alias 'application/json', :json
112
- # end
113
- # end
114
- # end
115
- SingleSpaceBeforeFirstArg:
57
+ Style/SpaceInsideHashLiteralBraces:
58
+ EnforcedStyle: no_space
59
+
60
+ Style/TrivialAccessors:
116
61
  Enabled: false
@@ -1,21 +1,21 @@
1
- bundler_args: --without development
1
+ bundler_args: --without development doc
2
2
  env:
3
3
  global:
4
4
  - JRUBY_OPTS="$JRUBY_OPTS --debug"
5
5
  language: ruby
6
6
  rvm:
7
- - 1.8.7
8
- - 1.9.2
9
7
  - 1.9.3
10
8
  - 2.0.0
11
9
  - 2.1
12
- - jruby-18mode
10
+ - 2.2
13
11
  - jruby-19mode
14
12
  - jruby-head
15
- - rbx-2
16
13
  - ruby-head
14
+ - rbx-2
17
15
  matrix:
18
16
  allow_failures:
19
17
  - rvm: jruby-head
20
18
  - rvm: ruby-head
19
+ - rvm: rbx-2
21
20
  fast_finish: true
21
+ sudo: false
@@ -0,0 +1,2 @@
1
+ --markup-provider=redcarpet
2
+ --markup=markdown
data/CHANGES.md CHANGED
@@ -1,10 +1,26 @@
1
- 0.6.4 (2015-03-25)
1
+ 0.7.0 (2015-01-02)
2
2
  ------------------
3
3
 
4
- * SECURITY FIX: http.rb failed to call the `#post_connection_check` method on
5
- SSL connections. This method implements hostname verification, and without it
6
- `http.rb` was vulnerable to MitM attacks. The problem was corrected by calling
7
- `#post_connection_check` (CVE-2015-1828) (@zanker, backported by @nicoolas25)
4
+ * Fix handling of EOF which caused infinite loop. See #163, #166 and #152. (@mickm, @ixti)
5
+ * Drop Ruby 1.8.7 support. (@ixti)
6
+ * Fix default Host header value. See #150. (@ixti)
7
+ * Remove BearerToken authorization header. (@ixti)
8
+ * `#auth` sugar now accepts only string value of Authorization header.
9
+ Calling `#auth(:basic, opts)` is deprecated, use `#basic_auth(opts)` instead.
10
+ (@ixti)
11
+ * Fix handling of chunked responses without Content-Length header. (@ixti)
12
+ * Remove `HTTP::Request#method` and deprecate `HTTP::Request#__method__`
13
+ (@sferik)
14
+ * Deprecate `HTTP::Response::STATUS_CODES`,
15
+ use `HTTP::Response::Status::REASONS` instead (@ixti)
16
+ * Deprecate `HTTP::Response::SYMBOL_TO_STATUS_CODE` (@ixti)
17
+ * Deprecate `HTTP::Response#status_code` (@ixti)
18
+ * `HTTP::Response#status` now returns `HTTP::Response::Status`. (@ixti)
19
+ * `HTTP::Response#reason` and `HTTP::Response#code` are proxies them
20
+ to corresponding methods of `HTTP::Response#status` (@ixti)
21
+ * Rename `HTTP.with_follow` to `HTTP.follow` and mark former one as being
22
+ deprecated (@ixti)
23
+ * Delegate `HTTP::Response#readpartial` to `HTTP::Response::Body` (@ixti)
8
24
 
9
25
  0.6.3 (2014-11-14)
10
26
  ------------------
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rake', '~> 10.1.1'
4
3
  gem 'jruby-openssl' if defined? JRUBY_VERSION
4
+ gem 'rake'
5
5
 
6
6
  group :development do
7
7
  gem 'pry'
@@ -18,16 +18,19 @@ end
18
18
  group :test do
19
19
  gem 'backports'
20
20
  gem 'coveralls'
21
- gem 'json', '>= 1.8.1', :platforms => [:jruby, :rbx, :ruby_18, :ruby_19]
22
- gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
23
- gem 'rest-client', '~> 1.6.0', :platforms => [:jruby, :ruby_18]
24
- gem 'rspec', '~> 2.14'
25
- gem 'rubocop', '~> 0.24.0', :platforms => [:ruby_19, :ruby_20, :ruby_21]
21
+ gem 'json', '>= 1.8.1', :platforms => [:jruby, :rbx, :ruby_19]
22
+ gem 'mime-types', '~> 1.25', :platforms => [:jruby]
23
+ gem 'rest-client', '~> 1.6.0', :platforms => [:jruby]
24
+ gem 'rspec', '~> 3.0'
25
+ gem 'rspec-its'
26
+ gem 'rubocop', '~> 0.25.0', :platforms => [:ruby_19, :ruby_20, :ruby_21]
26
27
  gem 'simplecov', '>= 0.9'
27
28
  gem 'yardstick'
28
- gem 'certificate_authority'
29
- gem 'activemodel', '~> 3.0'
30
- gem 'i18n', '~> 0.6.0'
29
+ end
30
+
31
+ group :doc do
32
+ gem 'yard'
33
+ gem 'redcarpet'
31
34
  end
32
35
 
33
36
  # Specify your gem's dependencies in http.gemspec
data/Guardfile CHANGED
@@ -2,8 +2,7 @@
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
4
  guard :rspec do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
5
+ watch(/^spec\/.+_spec\.rb$/)
6
+ watch(/^lib\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { 'spec' }
8
8
  end
9
-
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Tony Arcieri, Erik Michaels-Ober
1
+ Copyright (c) 2011-15 Tony Arcieri, Erik Michaels-Ober, Aleksey V. Zapparov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,24 +1,20 @@
1
- ![The HTTP Gem](https://raw.github.com/tarcieri/http/master/logo.png)
1
+ ![http.rb](https://raw.github.com/httprb/http.rb/master/logo.png)
2
2
  ==============
3
3
  [![Gem Version](https://badge.fury.io/rb/http.png)](http://rubygems.org/gems/http)
4
- [![Build Status](https://secure.travis-ci.org/tarcieri/http.png?branch=master)](http://travis-ci.org/tarcieri/http)
5
- [![Code Climate](https://codeclimate.com/github/tarcieri/http.png)](https://codeclimate.com/github/tarcieri/http)
6
- [![Coverage Status](https://coveralls.io/repos/tarcieri/http/badge.png?branch=master)](https://coveralls.io/r/tarcieri/http)
7
-
8
- SEO Note
9
- --------
10
-
11
- This Gem has the worst name in the history of SEO. But perhaps we can fix that if we
12
- all refer to it as "The HTTP Gem", or even better, the "Ruby HTTP Gem".
4
+ [![Build Status](https://secure.travis-ci.org/httprb/http.rb.png?branch=master)](http://travis-ci.org/httprb/http.rb)
5
+ [![Code Climate](https://codeclimate.com/github/httprb/http.rb.png)](https://codeclimate.com/github/httprb/http.rb)
6
+ [![Coverage Status](https://coveralls.io/repos/httprb/http.rb/badge.png?branch=master)](https://coveralls.io/r/httprb/http.rb)
13
7
 
14
8
  About
15
9
  -----
16
10
 
17
- The HTTP Gem is an easy-to-use client library for making requests from Ruby. It uses
18
- a simple method chaining system for building requests, similar to Python's [Requests]
11
+ http.rb is an easy-to-use client library for making requests from Ruby. It uses
12
+ a simple method chaining system for building requests, similar to Python's [Requests].
19
13
 
20
- Under the hood, The HTTP Gem uses [http_parser.rb], a fast HTTP parsing native
21
- extension based on the Node.js parser and a Java port thereof.
14
+ Under the hood, http.rb uses [http_parser.rb], a fast HTTP parsing native
15
+ extension based on the Node.js parser and a Java port thereof. This library
16
+ isn't just yet another wrapper around Net::HTTP. It implements the HTTP protocol
17
+ natively and outsources the parsing to native extensions.
22
18
 
23
19
  [requests]: http://docs.python-requests.org/en/latest/
24
20
  [http_parser.rb]: https://github.com/tmm1/http_parser.rb
@@ -26,16 +22,17 @@ extension based on the Node.js parser and a Java port thereof.
26
22
  Help and Discussion
27
23
  -------------------
28
24
 
29
- If you need help or just want to talk about the Ruby HTTP Gem, [visit our Google
30
- Group][googlegroup], or join by email by sending a message to:
31
- [ruby-http-gem+subscribe@googlegroups.com][subscribe].
25
+ If you need help or just want to talk about the http.rb,
26
+ [visit the http.rb Google Group][googlegroup],
27
+ or join by email by sending a message to:
28
+ [httprb+subscribe@googlegroups.com][subscribe].
32
29
 
33
- [googlegroup]: https://groups.google.com/forum/#!forum/ruby-http-gem
34
- [subscribe]: mailto:ruby-http-gem+subscribe@googlegroups.com
30
+ [googlegroup]: https://groups.google.com/forum/#!forum/httprb
31
+ [subscribe]: mailto:httprb+subscribe@googlegroups.com
35
32
 
36
33
  If you believe you've found a bug, please report it at:
37
34
 
38
- https://github.com/tarcieri/http/issues
35
+ https://github.com/httprb/http.rb/issues
39
36
 
40
37
  Installation
41
38
  ------------
@@ -61,7 +58,7 @@ Inside of your Ruby program do:
61
58
  Documentation
62
59
  -------------
63
60
 
64
- [Please see the HTTP Gem Wiki](https://github.com/tarcieri/http/wiki)
61
+ [Please see the http.rb wiki](https://github.com/httprb/http/wiki)
65
62
  for more detailed documentation and usage notes.
66
63
 
67
64
  Basic Usage
@@ -107,27 +104,32 @@ In practice you'll want to bind the HTTP::ResponseBody to a local variable (e.g.
107
104
  Making POST requests is simple too. Want to POST a form?
108
105
 
109
106
  ```ruby
110
- HTTP.post "http://example.com/resource", :form => {:foo => "42"}
107
+ HTTP.post("http://example.com/resource", :form => {:foo => "42"})
111
108
  ```
112
109
  Making GET requests with query string parameters is as simple.
113
110
 
114
111
  ```ruby
115
- HTTP.get "http://example.com/resource", :params => {:foo => "bar"}
112
+ HTTP.get("http://example.com/resource", :params => {:foo => "bar"})
116
113
  ```
117
114
 
118
115
  Want to POST with a specific body, JSON for instance?
119
116
 
120
117
  ```ruby
121
- HTTP.post "http://example.com/resource", :json => { :foo => '42' }
118
+ HTTP.post("http://example.com/resource", :json => { :foo => '42' })
122
119
  ```
123
120
 
124
- It's easy!
121
+ Or just a plain body?
125
122
 
123
+ ```ruby
124
+ HTTP.post("http://example.com/resource", :body => "foo=42&bar=baz")
125
+ ```
126
+
127
+ It's easy!
126
128
 
127
129
  ### Proxy Support
128
130
 
129
131
  Making request behind proxy is as simple as making them directly. Just specify
130
- hostname (or IP address) of your proxy server and it's port, and here you go:
132
+ hostname (or IP address) of your proxy server and its port, and here you go:
131
133
 
132
134
  ```ruby
133
135
  HTTP.via("proxy-hostname.local", 8080)
@@ -141,18 +143,17 @@ HTTP.via("proxy-hostname.local", 8080, "username", "password")
141
143
  .get "http://example.com/resource"
142
144
  ```
143
145
 
144
-
145
146
  ### Adding Headers
146
147
 
147
148
  The HTTP gem uses the concept of chaining to simplify requests. Let's say
148
- you want to get the latest commit of this library from Github in JSON format.
149
+ you want to get the latest commit of this library from GitHub in JSON format.
149
150
  One way we could do this is by tacking a filename on the end of the URL:
150
151
 
151
152
  ```ruby
152
- HTTP.get "https://github.com/tarcieri/http/commit/HEAD.json"
153
+ HTTP.get("https://github.com/httprb/http/commit/HEAD.json")
153
154
  ```
154
155
 
155
- The Github API happens to support this approach, but really this is a bit of a
156
+ The GitHub API happens to support this approach, but really this is a bit of a
156
157
  hack that makes it easy for people typing URLs into the address bars of
157
158
  browsers to perform the act of content negotiation. Since we have access to
158
159
  the full, raw power of HTTP, we can perform content negotiation the way HTTP
@@ -160,22 +161,45 @@ intends us to, by using the Accept header:
160
161
 
161
162
  ```ruby
162
163
  HTTP.with_headers(:accept => 'application/json').
163
- get("https://github.com/tarcieri/http/commit/HEAD")
164
+ get("https://github.com/httprb/http/commit/HEAD")
164
165
  ```
165
166
 
166
- This requests JSON from Github. Github is smart enough to understand our
167
- request and returns a response with Content-Type: application/json. If you
168
- happen to have a library loaded which defines the JSON constant and implements
169
- JSON.parse, the HTTP gem will attempt to parse the JSON response.
167
+ This requests JSON from GitHub. GitHub is smart enough to understand our
168
+ request and returns a response with Content-Type: application/json.
170
169
 
171
170
  Shorter aliases exists for HTTP.with_headers:
172
171
 
173
172
  ```ruby
174
173
  HTTP.with(:accept => 'application/json').
175
- get("https://github.com/tarcieri/http/commit/HEAD")
174
+ get("https://github.com/httprb/http/commit/HEAD")
176
175
 
177
176
  HTTP[:accept => 'application/json'].
178
- get("https://github.com/tarcieri/http/commit/HEAD")
177
+ get("https://github.com/httprb/http/commit/HEAD")
178
+ ```
179
+
180
+ ### Authorization Header
181
+
182
+ With [HTTP Basic Authentication](http://tools.ietf.org/html/rfc2617) username
183
+ and password:
184
+
185
+ ```ruby
186
+ HTTP.basic_auth(:user => 'user', :pass => 'pass')
187
+ # <HTTP::Headers {"Authorization"=>"Basic dXNlcjpwYXNz"}>
188
+ ```
189
+
190
+ Or with plain as-is value:
191
+
192
+ ```ruby
193
+ HTTP.auth("Bearer VGhlIEhUVFAgR2VtLCBST0NLUw")
194
+ # <HTTP::Headers {"Authorization"=>"Bearer VGhlIEhUVFAgR2VtLCBST0NLUw"}>
195
+ ```
196
+
197
+ And Chain all together!
198
+
199
+ ```ruby
200
+ HTTP.basic_auth(:user => 'user', :pass => 'pass')
201
+ .with('Cookie' => '9wq3w')
202
+ .get('https://example.com')
179
203
  ```
180
204
 
181
205
  ### Content Negotiation
@@ -185,17 +209,16 @@ right? But usually it's not, and so we end up adding ".json" onto the ends of
185
209
  our URLs because the existing mechanisms make it too hard. It should be easy:
186
210
 
187
211
  ```ruby
188
- HTTP.accept(:json).get("https://github.com/tarcieri/http/commit/HEAD")
212
+ HTTP.accept(:json).get("https://github.com/httprb/http/commit/HEAD")
189
213
  ```
190
214
 
191
215
  This adds the appropriate Accept header for retrieving a JSON response for the
192
216
  given resource.
193
217
 
194
-
195
218
  ### Celluloid::IO Support
196
219
 
197
- The HTTP Gem makes it simple to make multiple concurrent HTTP requests from a
198
- Celluloid::IO actor. Here's a parallel HTTP fetcher with the HTTP Gem and
220
+ http.rb makes it simple to make multiple concurrent HTTP requests from a
221
+ Celluloid::IO actor. Here's a parallel HTTP fetcher combining http.rb with
199
222
  Celluloid::IO:
200
223
 
201
224
  ```ruby
@@ -213,21 +236,19 @@ end
213
236
 
214
237
  There's a little more to it, but that's the core idea!
215
238
 
216
- * [Full parallel HTTP fetcher example](https://github.com/tarcieri/http/wiki/Parallel-requests-with-Celluloid%3A%3AIO)
239
+ * [Full parallel HTTP fetcher example](https://github.com/httprb/http/wiki/Parallel-requests-with-Celluloid%3A%3AIO)
217
240
  * See also: [Celluloid::IO](https://github.com/celluloid/celluloid-io)
218
241
 
219
-
220
242
  Supported Ruby Versions
221
243
  -----------------------
222
244
 
223
245
  This library aims to support and is [tested against][travis] the following Ruby
224
246
  versions:
225
247
 
226
- * Ruby 1.8.7
227
- * Ruby 1.9.2
228
248
  * Ruby 1.9.3
229
249
  * Ruby 2.0.0
230
- * Ruby 2.1.0
250
+ * Ruby 2.1.x
251
+ * Ruby 2.2.x
231
252
 
232
253
  If something doesn't work on one of these versions, it's a bug.
233
254
 
@@ -242,18 +263,20 @@ patches in a timely fashion. If critical issues for a particular implementation
242
263
  exist at the time of a major release, support for that Ruby version may be
243
264
  dropped.
244
265
 
245
- [travis]: http://travis-ci.org/tarcieri/http
246
-
266
+ [travis]: http://travis-ci.org/httprb/http.rb
247
267
 
248
- Contributing to The HTTP Gem
249
- ----------------------------
268
+ Contributing to http.rb
269
+ -----------------------
250
270
 
251
- * Fork the HTTP gem on github
252
- * Make your changes and send me a pull request
271
+ * Fork http.rb on GitHub
272
+ * Make your changes
273
+ * Ensure all tests pass (`bundle exec rake`)
274
+ * Send a pull request
253
275
  * If we like them we'll merge them
254
276
  * If we've accepted a patch, feel free to ask for commit access!
255
277
 
256
278
  Copyright
257
279
  ---------
258
280
 
259
- Copyright (c) 2014 Tony Arcieri, Erik Michaels-Ober. See LICENSE.txt for further details.
281
+ Copyright (c) 2011-15 Tony Arcieri, Erik Michaels-Ober, Aleksey V. Zapparov.
282
+ See LICENSE.txt for further details.