ethon 0.5.4 → 0.5.6

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,15 @@
2
2
 
3
3
  ## Master
4
4
 
5
- [Full Changelog](http://github.com/typhoeus/ethon/compare/v0.5.4...master)
5
+ [Full Changelog](http://github.com/typhoeus/ethon/compare/v0.5.6...master)
6
+
7
+ ## 0.5.6
8
+
9
+ [Full Changelog](http://github.com/typhoeus/ethon/compare/v0.5.4...v0.5.6)
10
+
11
+ Bugfixes:
12
+
13
+ * Easy#reset resets on_complete callbacks.
6
14
 
7
15
  ## 0.5.4
8
16
 
@@ -1,5 +1,6 @@
1
1
  require 'ethon/curls/codes'
2
2
  require 'ethon/curls/options'
3
+ require 'ethon/curls/http_versions'
3
4
  require 'ethon/curls/infos'
4
5
  require 'ethon/curls/form_options'
5
6
  require 'ethon/curls/auth_types'
@@ -17,6 +18,7 @@ module Ethon
17
18
  extend ::FFI::Library
18
19
  extend Ethon::Curls::Codes
19
20
  extend Ethon::Curls::Options
21
+ extend Ethon::Curls::HttpVersions
20
22
  extend Ethon::Curls::Infos
21
23
  extend Ethon::Curls::FormOptions
22
24
  extend Ethon::Curls::AuthTypes
@@ -44,6 +44,9 @@ module Ethon
44
44
  # :nodoc:
45
45
  SSLVersion = enum(ssl_versions.to_a.flatten)
46
46
 
47
+ # :nodoc:
48
+ HTTPVersion = enum(http_versions.to_a.flatten)
49
+
47
50
  # :nodoc:
48
51
  MsgCode = enum(:msg_code, msg_codes)
49
52
  end
@@ -0,0 +1,22 @@
1
+ module Ethon
2
+ module Curls
3
+
4
+ # This module contains the available proxy types.
5
+ module HttpVersions
6
+
7
+ # Return http versions.
8
+ #
9
+ # @example Return http versions.
10
+ # Ethon::Curl.http_versions
11
+ #
12
+ # @return [ Hash ] The http_versions.
13
+ def http_versions
14
+ {
15
+ :none => 0,
16
+ :httpv1_0 => 1,
17
+ :httpv1_1 => 2
18
+ }
19
+ end
20
+ end
21
+ end
22
+ end
@@ -265,6 +265,7 @@ module Ethon
265
265
  def reset
266
266
  @url = nil
267
267
  @hash = nil
268
+ @on_complete = []
268
269
  Curl.easy_reset(handle)
269
270
  set_callbacks
270
271
  end
@@ -285,6 +285,27 @@ module Ethon
285
285
  Curl.set_option(:httppost, value_for(value, :string), handle)
286
286
  end
287
287
 
288
+ # Pass a long, set to one of the values described below. They force
289
+ # libcurl to use the specific HTTP versions. This is not sensible
290
+ # to do unless you have a good reason.
291
+ #
292
+ # Options:
293
+ #
294
+ # * :none: We don't care about what version the library uses.
295
+ # libcurl will use whatever it thinks fit.
296
+ # * :httpv1_0: Enforce HTTP 1.0 requests.
297
+ # * :httpv1_1: Enforce HTTP 1.1 requests.
298
+ #
299
+ # @example Set http_version option.
300
+ # easy.http_version = :httpv1_0
301
+ #
302
+ # @param [ Symbol ] value The value to set.
303
+ #
304
+ # @return [ void ]
305
+ def http_version=(value)
306
+ Curl.set_option(:http_version, value_for(value, :enum, :http_version), handle)
307
+ end
308
+
288
309
  # When uploading a file to a remote site, this option should be used to
289
310
  # tell libcurl what the expected size of the infile is. This value
290
311
  # should be passed as a long. See also CURLOPT_INFILESIZE_LARGE.
@@ -1044,6 +1065,10 @@ module Ethon
1044
1065
  Curl::SSLVersion.to_h.fetch(value) do
1045
1066
  raise Errors::InvalidValue.new(option, value)
1046
1067
  end
1068
+ elsif type == :enum && option == :http_version
1069
+ Curl::HTTPVersion.to_h.fetch(value) do
1070
+ raise Errors::InvalidValue.new(option, value)
1071
+ end
1047
1072
  elsif type == :enum && option == :proxytype
1048
1073
  Curl::Proxy.to_h.fetch(value) do
1049
1074
  raise Errors::InvalidValue.new(option, value)
@@ -1,5 +1,5 @@
1
1
  module Ethon
2
2
 
3
3
  # Ethon version.
4
- VERSION = '0.5.4'
4
+ VERSION = '0.5.6'
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.4
4
+ version: 0.5.6
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-15 00:00:00.000000000 Z
12
+ date: 2012-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -57,6 +57,7 @@ files:
57
57
  - lib/ethon/curls/constants.rb
58
58
  - lib/ethon/curls/form_options.rb
59
59
  - lib/ethon/curls/functions.rb
60
+ - lib/ethon/curls/http_versions.rb
60
61
  - lib/ethon/curls/infos.rb
61
62
  - lib/ethon/curls/messages.rb
62
63
  - lib/ethon/curls/options.rb
@@ -122,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
123
  version: '0'
123
124
  segments:
124
125
  - 0
125
- hash: 246496117609865892
126
+ hash: 1804123915418513157
126
127
  required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  none: false
128
129
  requirements: