httpi 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -0
- data/README.md +6 -1
- data/Rakefile +4 -4
- data/httpi.gemspec +0 -2
- data/lib/httpi/adapter.rb +7 -7
- data/lib/httpi/adapter/curb.rb +0 -6
- data/lib/httpi/adapter/httpclient.rb +1 -1
- data/lib/httpi/adapter/net_http.rb +0 -2
- data/lib/httpi/auth/config.rb +5 -8
- data/lib/httpi/version.rb +1 -1
- data/spec/integration/request_spec.rb +2 -2
- metadata +13 -47
- data/.gemtest +0 -0
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.9.5 (2011-06-30)
|
2
|
+
|
3
|
+
* Improvement: Moved support for NTLM authentication into a separate gem.
|
4
|
+
Since NTLM support caused quite some problems for people who didn't even
|
5
|
+
need it, I decided to move it into httpi-ntlm until it's stable.
|
6
|
+
|
1
7
|
## 0.9.4 (2011-05-15)
|
2
8
|
|
3
9
|
* Fix: issues [34](https://github.com/rubiii/httpi/issues/34) and
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -172,9 +172,14 @@ HTTPI::Auth
|
|
172
172
|
``` ruby
|
173
173
|
request.auth.basic("username", "password") # HTTP basic auth credentials
|
174
174
|
request.auth.digest("username", "password") # HTTP digest auth credentials
|
175
|
-
request.auth.ntlm("username", "password") # NTLM auth credentials
|
176
175
|
```
|
177
176
|
|
177
|
+
For experimental NTLM authentication, please use the [httpi-ntlm](rubygems.org/gems/httpi-ntml)
|
178
|
+
gem and provide feedback.
|
179
|
+
|
180
|
+
``` ruby
|
181
|
+
request.auth.ntlm("username", "password") # NTLM auth credentials
|
182
|
+
```
|
178
183
|
|
179
184
|
HTTPI::Auth::SSL
|
180
185
|
----------------
|
data/Rakefile
CHANGED
@@ -5,14 +5,14 @@ require "rspec/core/rake_task"
|
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new do |t|
|
7
7
|
t.pattern = "spec/httpi/**/*_spec.rb"
|
8
|
-
t.rspec_opts = %w(-fd -c)
|
9
8
|
end
|
10
9
|
|
11
10
|
desc "Run RSpec integration examples"
|
12
|
-
RSpec::Core::RakeTask.new "
|
11
|
+
RSpec::Core::RakeTask.new "spec_integration" do |t|
|
13
12
|
t.pattern = "spec/integration/*_spec.rb"
|
14
|
-
t.rspec_opts = %w(-fd -c)
|
15
13
|
end
|
16
14
|
|
17
15
|
task :default => :spec
|
18
|
-
|
16
|
+
|
17
|
+
desc "Run RSpec code and integration examples"
|
18
|
+
task :ci => [:spec, :spec_integration]
|
data/httpi.gemspec
CHANGED
@@ -15,13 +15,11 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rubyforge_project = s.name
|
16
16
|
|
17
17
|
s.add_dependency "rack"
|
18
|
-
s.add_dependency "pyu-ntlm-http", ">= 0.1.3.1"
|
19
18
|
|
20
19
|
s.add_development_dependency "rspec", "~> 2.2"
|
21
20
|
s.add_development_dependency "autotest"
|
22
21
|
s.add_development_dependency "mocha", "~> 0.9.9"
|
23
22
|
s.add_development_dependency "webmock", "~> 1.4.0"
|
24
|
-
s.add_development_dependency "mock-server", "~> 0.1.1"
|
25
23
|
|
26
24
|
s.files = `git ls-files`.split("\n")
|
27
25
|
s.require_path = "lib"
|
data/lib/httpi/adapter.rb
CHANGED
@@ -14,9 +14,9 @@ module HTTPI
|
|
14
14
|
module Adapter
|
15
15
|
|
16
16
|
ADAPTERS = {
|
17
|
-
:httpclient => { :class => HTTPClient, :
|
18
|
-
:curb => { :class => Curb, :
|
19
|
-
:net_http => { :class => NetHTTP, :
|
17
|
+
:httpclient => { :class => HTTPClient, :require => "httpclient" },
|
18
|
+
:curb => { :class => Curb, :require => "curb" },
|
19
|
+
:net_http => { :class => NetHTTP, :require => "net/https" }
|
20
20
|
}
|
21
21
|
|
22
22
|
LOAD_ORDER = [:httpclient, :curb, :net_http]
|
@@ -27,7 +27,7 @@ module HTTPI
|
|
27
27
|
return @adapter = nil if adapter.nil?
|
28
28
|
|
29
29
|
validate_adapter! adapter
|
30
|
-
|
30
|
+
load_adapter adapter
|
31
31
|
@adapter = adapter
|
32
32
|
end
|
33
33
|
|
@@ -50,7 +50,7 @@ module HTTPI
|
|
50
50
|
def default_adapter
|
51
51
|
LOAD_ORDER.each do |adapter|
|
52
52
|
begin
|
53
|
-
|
53
|
+
load_adapter adapter
|
54
54
|
return adapter
|
55
55
|
rescue LoadError
|
56
56
|
next
|
@@ -58,8 +58,8 @@ module HTTPI
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
def
|
62
|
-
ADAPTERS[adapter][:
|
61
|
+
def load_adapter(adapter)
|
62
|
+
require ADAPTERS[adapter][:require]
|
63
63
|
end
|
64
64
|
|
65
65
|
end
|
data/lib/httpi/adapter/curb.rb
CHANGED
@@ -59,7 +59,6 @@ module HTTPI
|
|
59
59
|
basic_setup request
|
60
60
|
setup_http_auth request if request.auth.http?
|
61
61
|
setup_ssl_auth request.auth.ssl if request.auth.ssl?
|
62
|
-
setup_ntlm_auth request if request.auth.ntlm?
|
63
62
|
end
|
64
63
|
|
65
64
|
def basic_setup(request)
|
@@ -84,11 +83,6 @@ module HTTPI
|
|
84
83
|
client.ssl_verify_peer = ssl.verify_mode == :peer
|
85
84
|
end
|
86
85
|
|
87
|
-
def setup_ntlm_auth(request)
|
88
|
-
client.username, client.password = *request.auth.credentials
|
89
|
-
client.http_auth_types = request.auth.type
|
90
|
-
end
|
91
|
-
|
92
86
|
def respond_with(client)
|
93
87
|
status, headers = parse_header_string(client.header_str)
|
94
88
|
Response.new client.response_code, headers, client.body_str
|
@@ -99,9 +99,7 @@ module HTTPI
|
|
99
99
|
end
|
100
100
|
|
101
101
|
request_client = request_class.new request.url.request_uri, request.headers
|
102
|
-
|
103
102
|
request_client.basic_auth *request.auth.credentials if request.auth.basic?
|
104
|
-
request_client.ntlm_auth *request.auth.credentials if request.auth.ntlm?
|
105
103
|
|
106
104
|
request_client
|
107
105
|
end
|
data/lib/httpi/auth/config.rb
CHANGED
@@ -10,7 +10,7 @@ module HTTPI
|
|
10
10
|
class Config
|
11
11
|
|
12
12
|
# Supported authentication types.
|
13
|
-
TYPES = [:basic, :digest, :ssl
|
13
|
+
TYPES = [:basic, :digest, :ssl]
|
14
14
|
|
15
15
|
# Accessor for the HTTP basic auth credentials.
|
16
16
|
def basic(*args)
|
@@ -43,17 +43,14 @@ module HTTPI
|
|
43
43
|
type == :basic || type == :digest
|
44
44
|
end
|
45
45
|
|
46
|
-
#
|
46
|
+
# Only available with the httpi-ntlm gem.
|
47
47
|
def ntlm(*args)
|
48
|
-
|
49
|
-
|
50
|
-
self.type = :ntlm
|
51
|
-
@ntlm = args.flatten.compact
|
48
|
+
raise "Install the httpi-ntlm gem for experimental NTLM support"
|
52
49
|
end
|
53
50
|
|
54
|
-
#
|
51
|
+
# Only available with the httpi-ntlm gem.
|
55
52
|
def ntlm?
|
56
|
-
|
53
|
+
raise "Install the httpi-ntlm gem for experimental NTLM support"
|
57
54
|
end
|
58
55
|
|
59
56
|
# Returns the <tt>HTTPI::Auth::SSL</tt> object.
|
data/lib/httpi/version.rb
CHANGED
@@ -77,7 +77,7 @@ describe HTTPI do
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
HTTPI::Adapter.
|
80
|
+
HTTPI::Adapter::ADAPTERS.keys.each do |adapter|
|
81
81
|
context "using :#{adapter}" do
|
82
82
|
let(:adapter) { adapter }
|
83
83
|
it_should_behave_like "an HTTP client"
|
@@ -85,7 +85,7 @@ describe HTTPI do
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
(HTTPI::Adapter.
|
88
|
+
(HTTPI::Adapter::ADAPTERS.keys - [:net_http]).each do |adapter|
|
89
89
|
context "using :#{adapter}" do
|
90
90
|
let(:adapter) { adapter }
|
91
91
|
it_should_behave_like "it works with HTTP digest auth"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 5
|
10
|
+
version: 0.9.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Harrington
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-06-29 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: rack
|
@@ -32,27 +32,10 @@ dependencies:
|
|
32
32
|
version: "0"
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: pyu-ntlm-http
|
37
|
-
prerelease: false
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 73
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
- 1
|
47
|
-
- 3
|
48
|
-
- 1
|
49
|
-
version: 0.1.3.1
|
50
|
-
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
35
|
- !ruby/object:Gem::Dependency
|
53
36
|
name: rspec
|
54
37
|
prerelease: false
|
55
|
-
requirement: &
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
56
39
|
none: false
|
57
40
|
requirements:
|
58
41
|
- - ~>
|
@@ -63,11 +46,11 @@ dependencies:
|
|
63
46
|
- 2
|
64
47
|
version: "2.2"
|
65
48
|
type: :development
|
66
|
-
version_requirements: *
|
49
|
+
version_requirements: *id002
|
67
50
|
- !ruby/object:Gem::Dependency
|
68
51
|
name: autotest
|
69
52
|
prerelease: false
|
70
|
-
requirement: &
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
71
54
|
none: false
|
72
55
|
requirements:
|
73
56
|
- - ">="
|
@@ -77,11 +60,11 @@ dependencies:
|
|
77
60
|
- 0
|
78
61
|
version: "0"
|
79
62
|
type: :development
|
80
|
-
version_requirements: *
|
63
|
+
version_requirements: *id003
|
81
64
|
- !ruby/object:Gem::Dependency
|
82
65
|
name: mocha
|
83
66
|
prerelease: false
|
84
|
-
requirement: &
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
85
68
|
none: false
|
86
69
|
requirements:
|
87
70
|
- - ~>
|
@@ -93,11 +76,11 @@ dependencies:
|
|
93
76
|
- 9
|
94
77
|
version: 0.9.9
|
95
78
|
type: :development
|
96
|
-
version_requirements: *
|
79
|
+
version_requirements: *id004
|
97
80
|
- !ruby/object:Gem::Dependency
|
98
81
|
name: webmock
|
99
82
|
prerelease: false
|
100
|
-
requirement: &
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
101
84
|
none: false
|
102
85
|
requirements:
|
103
86
|
- - ~>
|
@@ -109,23 +92,7 @@ dependencies:
|
|
109
92
|
- 0
|
110
93
|
version: 1.4.0
|
111
94
|
type: :development
|
112
|
-
version_requirements: *
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: mock-server
|
115
|
-
prerelease: false
|
116
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
117
|
-
none: false
|
118
|
-
requirements:
|
119
|
-
- - ~>
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
hash: 25
|
122
|
-
segments:
|
123
|
-
- 0
|
124
|
-
- 1
|
125
|
-
- 1
|
126
|
-
version: 0.1.1
|
127
|
-
type: :development
|
128
|
-
version_requirements: *id007
|
95
|
+
version_requirements: *id005
|
129
96
|
description: HTTPI provides a common interface for Ruby HTTP libraries.
|
130
97
|
email: me@rubiii.com
|
131
98
|
executables: []
|
@@ -136,7 +103,6 @@ extra_rdoc_files: []
|
|
136
103
|
|
137
104
|
files:
|
138
105
|
- .autotest
|
139
|
-
- .gemtest
|
140
106
|
- .gitignore
|
141
107
|
- .rspec
|
142
108
|
- .travis.yml
|
@@ -208,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
174
|
requirements: []
|
209
175
|
|
210
176
|
rubyforge_project: httpi
|
211
|
-
rubygems_version: 1.
|
177
|
+
rubygems_version: 1.8.5
|
212
178
|
signing_key:
|
213
179
|
specification_version: 3
|
214
180
|
summary: Interface for Ruby HTTP libraries
|
data/.gemtest
DELETED
File without changes
|