excon 0.3.6 → 0.3.7

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

Potentially problematic release.


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

@@ -6,8 +6,10 @@ Http(s) EXtended CONnections
6
6
 
7
7
  sudo gem install excon
8
8
 
9
- Now you are ready to get started, easiest is to use one off requests to start.
9
+ Now you are ready to get started, easiest is to use one off requests to start. Windows users see the addendum at the end.
10
10
 
11
+ require 'rubygems'
12
+ require 'excon'
11
13
  Excon.get('http://geemus.com')
12
14
 
13
15
  This will return a response object, which has body, headers and status attributes you can check out.
@@ -31,6 +33,16 @@ If you need to do something special with a response you can also pass a block th
31
33
 
32
34
  From there you should be able to make just about any request you might need.
33
35
 
36
+ == Windows
37
+
38
+ On windows the default ssl peer certificate verification won't work out for you. You can opt after requiring excon like this:
39
+
40
+ require 'rubygems'
41
+ require 'excon'
42
+ Excon.ssl_verify_peer = false
43
+
44
+ I'll provide a better solution when I can (and you should know that in the mean time this is succeptible to man in the middle attacks).
45
+
34
46
  == Copyright
35
47
 
36
48
  (The MIT License)
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'excon'
16
- s.version = '0.3.6'
17
- s.date = '2010-12-22'
16
+ s.version = '0.3.7'
17
+ s.date = '2011-01-05'
18
18
  s.rubyforge_project = 'excon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -13,13 +13,24 @@ require 'excon/response'
13
13
  module Excon
14
14
 
15
15
  unless const_defined?(:VERSION)
16
- VERSION = '0.3.6'
16
+ VERSION = '0.3.7'
17
17
  end
18
18
 
19
19
  unless const_defined?(:CHUNK_SIZE)
20
20
  CHUNK_SIZE = 1048576 # 1 megabyte
21
21
  end
22
22
 
23
+ # Status of ssl peer verification
24
+ @ssl_verify_peer = true
25
+ def self.ssl_verify_peer
26
+ @ssl_verify_peer
27
+ end
28
+
29
+ # change the status of ssl peer verification
30
+ def self.ssl_verify_peer=(new_ssl_verify_peer)
31
+ @ssl_verify_peer = new_ssl_verify_peer
32
+ end
33
+
23
34
  # @see Connection#initialize
24
35
  # Initializes a new keep-alive session for a given remote host
25
36
  #
@@ -157,13 +157,19 @@ module Excon
157
157
  if @connection[:scheme] == 'https'
158
158
  # create ssl context
159
159
  ssl_context = OpenSSL::SSL::SSLContext.new
160
- # turn verification on
161
- ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER
162
160
 
163
- # use default cert store
164
- store = OpenSSL::X509::Store.new
165
- store.set_default_paths
166
- ssl_context.cert_store = store
161
+ if Excon.ssl_verify_peer
162
+ # turn verification on
163
+ ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER
164
+
165
+ # use default cert store
166
+ store = OpenSSL::X509::Store.new
167
+ store.set_default_paths
168
+ ssl_context.cert_store = store
169
+ else
170
+ # turn verification off
171
+ ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
172
+ end
167
173
 
168
174
  # open ssl socket
169
175
  new_socket = OpenSSL::SSL::SSLSocket.new(new_socket, ssl_context)
@@ -52,7 +52,7 @@ module Excon
52
52
  class Gone < HTTPStatusError; end # 410
53
53
  class LengthRequired < HTTPStatusError; end # 411
54
54
  class PreconditionFailed < HTTPStatusError; end # 412
55
- class RequestEntityTooLarge < HTTPStatusError; end # 412
55
+ class RequestEntityTooLarge < HTTPStatusError; end # 413
56
56
  class RequestURITooLong < HTTPStatusError; end # 414
57
57
  class UnsupportedMediaType < HTTPStatusError; end # 415
58
58
  class RequestedRangeNotSatisfiable < HTTPStatusError; end # 416
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 6
10
- version: 0.3.6
9
+ - 7
10
+ version: 0.3.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - geemus (Wesley Beary)
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-22 00:00:00 -08:00
18
+ date: 2011-01-05 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency