httpi 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.9.7 (2012-04-26)
2
+
3
+ * Fix: Merged [pull request 49](https://github.com/rubiii/httpi/pull/49) so that cert
4
+ and cert_key can be manually set.
5
+
6
+ * Fix: Stop auto-detecting gzipped responses by inspecting the response body to allow
7
+ response compression only.
8
+
1
9
  ## 0.9.6 (2012-02-23)
2
10
 
3
11
  * Feature: Merged [pull request 46](https://github.com/rubiii/httpi/pull/46) to support
@@ -54,7 +54,7 @@ module HTTPI
54
54
 
55
55
  # Returns an <tt>OpenSSL::X509::Certificate</tt> for the +cert_file+.
56
56
  def cert
57
- @cert ||= OpenSSL::X509::Certificate.new File.read(cert_file) if cert_file
57
+ @cert ||= (OpenSSL::X509::Certificate.new File.read(cert_file) if cert_file)
58
58
  end
59
59
 
60
60
  # Sets the +OpenSSL+ certificate.
@@ -70,7 +70,7 @@ module HTTPI
70
70
 
71
71
  # Returns an <tt>OpenSSL::PKey::RSA</tt> for the +cert_key_file+.
72
72
  def cert_key
73
- @cert_key ||= OpenSSL::PKey::RSA.new(File.read(cert_key_file), cert_key_password) if cert_key_file
73
+ @cert_key ||= (OpenSSL::PKey::RSA.new(File.read(cert_key_file), cert_key_password) if cert_key_file)
74
74
  end
75
75
 
76
76
  # Sets the +OpenSSL+ certificate key.
@@ -50,14 +50,14 @@ module HTTPI
50
50
 
51
51
  def decode_body
52
52
  return @body = "" if !raw_body || raw_body.empty?
53
-
53
+
54
54
  body = gzipped_response? ? decoded_gzip_body : raw_body
55
55
  @body = dime_response? ? decoded_dime_body(body) : body
56
56
  end
57
57
 
58
58
  # Returns whether the response is gzipped.
59
59
  def gzipped_response?
60
- headers["Content-Encoding"] == "gzip" || raw_body[0..1] == "\x1f\x8b"
60
+ headers["Content-Encoding"] == "gzip"
61
61
  end
62
62
 
63
63
  # Returns whether this is a DIME response.
data/lib/httpi/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module HTTPI
2
2
 
3
- VERSION = "0.9.6"
3
+ VERSION = "0.9.7"
4
4
 
5
5
  end
@@ -66,6 +66,13 @@ describe HTTPI::Auth::SSL do
66
66
  ssl = HTTPI::Auth::SSL.new
67
67
  ssl.cert.should be_nil
68
68
  end
69
+
70
+ it "returns the explicitly given certificate if set" do
71
+ ssl = HTTPI::Auth::SSL.new
72
+ cert = OpenSSL::X509::Certificate.new
73
+ ssl.cert = cert
74
+ ssl.cert.should == cert
75
+ end
69
76
  end
70
77
 
71
78
  describe "#cert_key" do
@@ -77,6 +84,13 @@ describe HTTPI::Auth::SSL do
77
84
  ssl = HTTPI::Auth::SSL.new
78
85
  ssl.cert_key.should be_nil
79
86
  end
87
+
88
+ it "returns the explicitly given key if set" do
89
+ ssl = HTTPI::Auth::SSL.new
90
+ key = OpenSSL::PKey::RSA.new
91
+ ssl.cert_key = key
92
+ ssl.cert_key.should == key
93
+ end
80
94
  end
81
95
 
82
96
  describe "#ca_cert" do
metadata CHANGED
@@ -1,139 +1,135 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: httpi
3
- version: !ruby/object:Gem::Version
4
- hash: 55
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.7
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 9
9
- - 6
10
- version: 0.9.6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Daniel Harrington
14
9
  - Martin Tepper
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2012-02-22 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- type: :runtime
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
33
- version_requirements: *id001
13
+ date: 2012-04-26 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
34
16
  name: rack
35
- - !ruby/object:Gem::Dependency
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
36
24
  prerelease: false
37
- type: :development
38
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
33
+ requirement: !ruby/object:Gem::Requirement
39
34
  none: false
40
- requirements:
35
+ requirements:
41
36
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 49
44
- segments:
45
- - 0
46
- - 8
47
- - 7
37
+ - !ruby/object:Gem::Version
48
38
  version: 0.8.7
49
- version_requirements: *id002
50
- name: rake
51
- - !ruby/object:Gem::Dependency
52
- prerelease: false
53
39
  type: :development
54
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
55
42
  none: false
56
- requirements:
43
+ requirements:
57
44
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 13
60
- segments:
61
- - 2
62
- - 7
63
- version: "2.7"
64
- version_requirements: *id003
45
+ - !ruby/object:Gem::Version
46
+ version: 0.8.7
47
+ - !ruby/object:Gem::Dependency
65
48
  name: rspec
66
- - !ruby/object:Gem::Dependency
67
- prerelease: false
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.7'
68
55
  type: :development
69
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
70
58
  none: false
71
- requirements:
59
+ requirements:
72
60
  - - ~>
73
- - !ruby/object:Gem::Version
74
- hash: 41
75
- segments:
76
- - 0
77
- - 9
78
- - 9
79
- version: 0.9.9
80
- version_requirements: *id004
61
+ - !ruby/object:Gem::Version
62
+ version: '2.7'
63
+ - !ruby/object:Gem::Dependency
81
64
  name: mocha
82
- - !ruby/object:Gem::Dependency
83
- prerelease: false
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: 0.9.9
84
71
  type: :development
85
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
86
74
  none: false
87
- requirements:
75
+ requirements:
88
76
  - - ~>
89
- - !ruby/object:Gem::Version
90
- hash: 7
91
- segments:
92
- - 1
93
- - 4
94
- - 0
95
- version: 1.4.0
96
- version_requirements: *id005
77
+ - !ruby/object:Gem::Version
78
+ version: 0.9.9
79
+ - !ruby/object:Gem::Dependency
97
80
  name: webmock
98
- - !ruby/object:Gem::Dependency
99
- prerelease: false
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: 1.4.0
100
87
  type: :development
101
- requirement: &id006 !ruby/object:Gem::Requirement
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
102
90
  none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- hash: 3
107
- segments:
108
- - 0
109
- version: "0"
110
- version_requirements: *id006
91
+ requirements:
92
+ - - ~>
93
+ - !ruby/object:Gem::Version
94
+ version: 1.4.0
95
+ - !ruby/object:Gem::Dependency
111
96
  name: autotest
112
- - !ruby/object:Gem::Dependency
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
113
104
  prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: ZenTest
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - '='
117
+ - !ruby/object:Gem::Version
118
+ version: 4.5.0
114
119
  type: :development
115
- requirement: &id007 !ruby/object:Gem::Requirement
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
116
122
  none: false
117
- requirements:
118
- - - "="
119
- - !ruby/object:Gem::Version
120
- hash: 43
121
- segments:
122
- - 4
123
- - 5
124
- - 0
123
+ requirements:
124
+ - - '='
125
+ - !ruby/object:Gem::Version
125
126
  version: 4.5.0
126
- version_requirements: *id007
127
- name: ZenTest
128
127
  description: HTTPI provides a common interface for Ruby HTTP libraries.
129
128
  email: me@rubiii.com
130
129
  executables: []
131
-
132
130
  extensions: []
133
-
134
131
  extra_rdoc_files: []
135
-
136
- files:
132
+ files:
137
133
  - .gitignore
138
134
  - .rspec
139
135
  - .travis.yml
@@ -177,36 +173,26 @@ files:
177
173
  - spec/support/matchers.rb
178
174
  homepage: http://github.com/rubiii/httpi
179
175
  licenses: []
180
-
181
176
  post_install_message:
182
177
  rdoc_options: []
183
-
184
- require_paths:
178
+ require_paths:
185
179
  - lib
186
- required_ruby_version: !ruby/object:Gem::Requirement
180
+ required_ruby_version: !ruby/object:Gem::Requirement
187
181
  none: false
188
- requirements:
189
- - - ">="
190
- - !ruby/object:Gem::Version
191
- hash: 3
192
- segments:
193
- - 0
194
- version: "0"
195
- required_rubygems_version: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ! '>='
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ required_rubygems_version: !ruby/object:Gem::Requirement
196
187
  none: false
197
- requirements:
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- hash: 3
201
- segments:
202
- - 0
203
- version: "0"
188
+ requirements:
189
+ - - ! '>='
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
204
192
  requirements: []
205
-
206
193
  rubyforge_project: httpi
207
- rubygems_version: 1.8.10
194
+ rubygems_version: 1.8.20
208
195
  signing_key:
209
196
  specification_version: 3
210
197
  summary: Interface for Ruby HTTP libraries
211
198
  test_files: []
212
-