ethon 0.5.7 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,16 @@
2
2
 
3
3
  ## Master
4
4
 
5
- [Full Changelog](http://github.com/typhoeus/ethon/compare/v0.5.7...master)
5
+ [Full Changelog](http://github.com/typhoeus/ethon/compare/v0.5.8...master)
6
+
7
+ ## 0.5.8
8
+
9
+ [Full Changelog](http://github.com/typhoeus/ethon/compare/v0.5.7...v0.5.8)
10
+
11
+ Enhancements:
12
+
13
+ * Add support for protocols and redir_protocols(
14
+ [libcurl SASL buffer overflow vulnerability](http://curl.haxx.se/docs/adv_20130206.html)).
6
15
 
7
16
  ## 0.5.7
8
17
 
@@ -4,6 +4,7 @@ require 'ethon/curls/http_versions'
4
4
  require 'ethon/curls/infos'
5
5
  require 'ethon/curls/form_options'
6
6
  require 'ethon/curls/auth_types'
7
+ require 'ethon/curls/protocols'
7
8
  require 'ethon/curls/proxy_types'
8
9
  require 'ethon/curls/ssl_versions'
9
10
  require 'ethon/curls/messages'
@@ -25,6 +26,7 @@ module Ethon
25
26
  extend Ethon::Curls::ProxyTypes
26
27
  extend Ethon::Curls::SslVersions
27
28
  extend Ethon::Curls::Messages
29
+ extend Ethon::Curls::Protocols
28
30
 
29
31
 
30
32
  require 'ethon/curls/constants'
@@ -12,12 +12,12 @@ module Ethon
12
12
  # @return [ Hash ] The auth types.
13
13
  def auth_types
14
14
  {
15
- :basic => 0x01,
16
- :digest => 0x02,
17
- :gssnegotiate =>0x04,
18
- :ntlm => 0x08,
19
- :digest_ie => 0x10,
20
- :auto => 0x1f
15
+ :basic => 0x01,
16
+ :digest => 0x02,
17
+ :gssnegotiate => 0x04,
18
+ :ntlm => 0x08,
19
+ :digest_ie => 0x10,
20
+ :auto => 0x1f
21
21
  }
22
22
  end
23
23
  end
@@ -38,6 +38,9 @@ module Ethon
38
38
  # :nodoc:
39
39
  Auth = enum(auth_types.to_a.flatten)
40
40
 
41
+ # :nodoc:
42
+ Protocols = enum(protocols.to_a.flatten)
43
+
41
44
  # :nodoc:
42
45
  Proxy = enum(proxy_types.to_a.flatten)
43
46
 
@@ -0,0 +1,36 @@
1
+ module Ethon
2
+ module Curls
3
+ module Protocols
4
+ def protocols
5
+ {
6
+ :http => 0x00000001,
7
+ :https => 0x00000002,
8
+ :ftp => 0x00000004,
9
+ :ftps => 0x00000008,
10
+ :scp => 0x00000010,
11
+ :sftp => 0x00000020,
12
+ :telnet => 0x00000040,
13
+ :ldap => 0x00000080,
14
+ :ldaps => 0x00000100,
15
+ :dict => 0x00001200,
16
+ :file => 0x00001400,
17
+ :tftp => 0x00001800,
18
+ :imap => 0x00011000,
19
+ :imaps => 0x00012000,
20
+ :pop3 => 0x00014000,
21
+ :pop3s => 0x00018000,
22
+ :smtp => 0x00110000,
23
+ :smtps => 0x00120000,
24
+ :rtsp => 0x00140000,
25
+ :rtmp => 0x00180000,
26
+ :rtmpt => 0x02100000,
27
+ :rtmpe => 0x02200000,
28
+ :rtmpte => 0x02400000,
29
+ :rtmps => 0x02800000,
30
+ :rtmpts => 0x21000000,
31
+ :gopher => 0x22000000,
32
+ }
33
+ end
34
+ end
35
+ end
36
+ end
@@ -446,6 +446,42 @@ module Ethon
446
446
  Curl.set_option(:postfieldsize, value_for(value, :int), handle)
447
447
  end
448
448
 
449
+ # Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this
450
+ # bitmask limits what protocols libcurl may use in the transfer. This
451
+ # allows you to have a libcurl built to support a wide range of protocols
452
+ # but still limit specific transfers to only be allowed to use a subset
453
+ # of them. By default libcurl will accept all protocols it supports. See
454
+ # also CURLOPT_REDIR_PROTOCOLS. (Added in 7.19.4)
455
+ #
456
+ # @example Set protocols option.
457
+ # easy.protocols = :http
458
+ #
459
+ # @param [ Symbol ] value The value to set.
460
+ #
461
+ # @return [ void ]
462
+ def protocols=(value)
463
+ Curl.set_option(:protocols, value_for(value, :enum, :protocols), handle)
464
+ end
465
+
466
+ # Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this
467
+ # bitmask limits what protocols libcurl may use in a transfer that it
468
+ # follows to in a redirect when CURLOPT_FOLLOWLOCATION is enabled. This
469
+ # allows you to limit specific transfers to only be allowed to use a
470
+ # subset of protocols in redirections. By default libcurl will allow all
471
+ # protocols except for FILE and SCP. This is a difference compared to
472
+ # pre-7.19.4 versions which unconditionally would follow to all protocols
473
+ # supported. (Added in 7.19.4)
474
+ #
475
+ # @example Set redir_protocols option.
476
+ # easy.redir_protocols = :http
477
+ #
478
+ # @param [ Symbol ] value The value to set.
479
+ #
480
+ # @return [ void ]
481
+ def redir_protocols=(value)
482
+ Curl.set_option(:redir_protocols, value_for(value, :enum, :redir_protocols), handle)
483
+ end
484
+
449
485
  # Set HTTP proxy to use. The parameter should be a string to a zero
450
486
  # terminated string holding the host name or dotted IP address. To
451
487
  # specify port number in this string, append :[port] to the end of the
@@ -1069,6 +1105,10 @@ module Ethon
1069
1105
  Curl::HTTPVersion.to_h.fetch(value) do
1070
1106
  raise Errors::InvalidValue.new(option, value)
1071
1107
  end
1108
+ elsif type == :enum && (option == :protocols || option == :redir_protocols)
1109
+ Curl::Protocols.to_h.fetch(value) do
1110
+ raise Errors::InvalidValue.new(option, value)
1111
+ end
1072
1112
  elsif type == :enum && option == :proxytype
1073
1113
  Curl::Proxy.to_h.fetch(value) do
1074
1114
  raise Errors::InvalidValue.new(option, value)
@@ -1,5 +1,5 @@
1
1
  module Ethon
2
2
 
3
3
  # Ethon version.
4
- VERSION = '0.5.7'
4
+ VERSION = '0.5.8'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ethon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-29 00:00:00.000000000 Z
12
+ date: 2013-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -61,6 +61,7 @@ files:
61
61
  - lib/ethon/curls/infos.rb
62
62
  - lib/ethon/curls/messages.rb
63
63
  - lib/ethon/curls/options.rb
64
+ - lib/ethon/curls/protocols.rb
64
65
  - lib/ethon/curls/proxy_types.rb
65
66
  - lib/ethon/curls/settings.rb
66
67
  - lib/ethon/curls/ssl_versions.rb
@@ -123,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
124
  version: '0'
124
125
  segments:
125
126
  - 0
126
- hash: 202971175461885038
127
+ hash: -3892708119982430515
127
128
  required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  none: false
129
130
  requirements: