httpi 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,8 @@
1
- script: "rake"
1
+ script: "rake ci"
2
2
  rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
5
5
  - ree
6
6
  - rbx
7
7
  - jruby
8
+ - ruby-head
@@ -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
@@ -6,3 +6,4 @@ gem "jruby-openssl", :platforms => :jruby
6
6
  # http clients
7
7
  gem "httpclient", "~> 2.1.7"
8
8
  gem "curb", "~> 0.7.8", :platforms => :ruby
9
+ gem "mock-server", :git => "https://github.com/djanowski/mock-server.git"
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 "spec:integration" do |t|
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
- task :test => :spec
16
+
17
+ desc "Run RSpec code and integration examples"
18
+ task :ci => [:spec, :spec_integration]
@@ -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"
@@ -14,9 +14,9 @@ module HTTPI
14
14
  module Adapter
15
15
 
16
16
  ADAPTERS = {
17
- :httpclient => { :class => HTTPClient, :dependencies => ["httpclient"] },
18
- :curb => { :class => Curb, :dependencies => ["curb"] },
19
- :net_http => { :class => NetHTTP, :dependencies => ["net/https", "net/ntlm_http"] }
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
- load_dependencies adapter
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
- load_dependencies adapter
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 load_dependencies(adapter)
62
- ADAPTERS[adapter][:dependencies].each { |dependency| require dependency }
61
+ def load_adapter(adapter)
62
+ require ADAPTERS[adapter][:require]
63
63
  end
64
64
 
65
65
  end
@@ -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
@@ -66,7 +66,7 @@ module HTTPI
66
66
 
67
67
  def setup_client(request)
68
68
  basic_setup request
69
- setup_auth request if request.auth.http? || request.auth.ntlm?
69
+ setup_auth request if request.auth.http?
70
70
  setup_ssl_auth request.auth.ssl if request.auth.ssl?
71
71
  end
72
72
 
@@ -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
@@ -10,7 +10,7 @@ module HTTPI
10
10
  class Config
11
11
 
12
12
  # Supported authentication types.
13
- TYPES = [:basic, :digest, :ssl, :ntlm]
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
- # Accessor for the NTLM auth credentials.
46
+ # Only available with the httpi-ntlm gem.
47
47
  def ntlm(*args)
48
- return @ntlm if args.empty?
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
- # Returns whether to use NTLM auth.
51
+ # Only available with the httpi-ntlm gem.
55
52
  def ntlm?
56
- type == :ntlm
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.
@@ -1,5 +1,5 @@
1
1
  module HTTPI
2
2
 
3
- VERSION = "0.9.4"
3
+ VERSION = "0.9.5"
4
4
 
5
5
  end
@@ -77,7 +77,7 @@ describe HTTPI do
77
77
  end
78
78
  end
79
79
 
80
- HTTPI::Adapter.adapters.keys.each do |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.adapters.keys - [:net_http]).each do |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: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 4
10
- version: 0.9.4
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-05-15 00:00:00 Z
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: &id003 !ruby/object:Gem::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: *id003
49
+ version_requirements: *id002
67
50
  - !ruby/object:Gem::Dependency
68
51
  name: autotest
69
52
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::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: *id004
63
+ version_requirements: *id003
81
64
  - !ruby/object:Gem::Dependency
82
65
  name: mocha
83
66
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::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: *id005
79
+ version_requirements: *id004
97
80
  - !ruby/object:Gem::Dependency
98
81
  name: webmock
99
82
  prerelease: false
100
- requirement: &id006 !ruby/object:Gem::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: *id006
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.7.2
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