ethon 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -1
- data/Gemfile +7 -1
- data/README.md +0 -4
- data/lib/ethon/curls/infos.rb +6 -30
- data/lib/ethon/curls/options.rb +8 -4
- data/lib/ethon/easy/callbacks.rb +4 -7
- data/lib/ethon/easy/operations.rb +1 -1
- data/lib/ethon/easy/response_callbacks.rb +3 -0
- data/lib/ethon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5b8550d86c3b12a213c5f44bc47575cc155b57f
|
4
|
+
data.tar.gz: 9c23490c1d3184612dea6e1e88a293a7444f65a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dfc9939d7232e54526cd3aebcda6a8c058d0620efcd50204e6e9d9b19c40484a4ee117a1b64761f5bdefd130ea0842a169dc5ddb108f6b73ddb325748db5e74
|
7
|
+
data.tar.gz: 4abc8b70ff4da5bce7edf2e7ea75c22bab080ea68f211618bc350bad55ab8df1ad7e1dd8f304dcdb85a21499b524f7ff40d064e7a42ad7175b1b787f7e0a576a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,11 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.9.
|
5
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.9.1...master)
|
6
|
+
|
7
|
+
## 0.9.1
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.9.0...v0.9.1)
|
6
10
|
|
7
11
|
## 0.9.0
|
8
12
|
|
data/Gemfile
CHANGED
@@ -11,7 +11,13 @@ group :development, :test do
|
|
11
11
|
gem "rspec", "~> 3.4"
|
12
12
|
|
13
13
|
gem "sinatra"
|
14
|
-
|
14
|
+
|
15
|
+
if Gem.ruby_version < Gem::Version.new("2.0.0")
|
16
|
+
gem "json", "< 2"
|
17
|
+
else
|
18
|
+
gem "json"
|
19
|
+
end
|
20
|
+
|
15
21
|
gem "mime-types", "~> 1.18"
|
16
22
|
|
17
23
|
unless ENV["CI"]
|
data/README.md
CHANGED
@@ -90,7 +90,3 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
90
90
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
91
91
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
92
92
|
OTHER DEALINGS IN THE SOFTWARE.
|
93
|
-
|
94
|
-
|
95
|
-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/typhoeus/ethon/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
96
|
-
|
data/lib/ethon/curls/infos.rb
CHANGED
@@ -104,6 +104,8 @@ module Ethon
|
|
104
104
|
#
|
105
105
|
# @return [ String ] The info.
|
106
106
|
def get_info_string(option, handle)
|
107
|
+
string_ptr = ::FFI::MemoryPointer.new(:pointer)
|
108
|
+
|
107
109
|
if easy_getinfo(handle, option, string_ptr) == :ok
|
108
110
|
ptr=string_ptr.read_pointer
|
109
111
|
ptr.null? ? nil : ptr.read_string
|
@@ -120,6 +122,8 @@ module Ethon
|
|
120
122
|
#
|
121
123
|
# @return [ Integer ] The info.
|
122
124
|
def get_info_long(option, handle)
|
125
|
+
long_ptr = ::FFI::MemoryPointer.new(:long)
|
126
|
+
|
123
127
|
if easy_getinfo(handle, option, long_ptr) == :ok
|
124
128
|
long_ptr.read_long
|
125
129
|
end
|
@@ -135,40 +139,12 @@ module Ethon
|
|
135
139
|
#
|
136
140
|
# @return [ Float ] The info.
|
137
141
|
def get_info_double(option, handle)
|
142
|
+
double_ptr = ::FFI::MemoryPointer.new(:double)
|
143
|
+
|
138
144
|
if easy_getinfo(handle, option, double_ptr) == :ok
|
139
145
|
double_ptr.read_double
|
140
146
|
end
|
141
147
|
end
|
142
|
-
|
143
|
-
# Return a string pointer.
|
144
|
-
#
|
145
|
-
# @example Return a string pointer.
|
146
|
-
# Curl.string_ptr
|
147
|
-
#
|
148
|
-
# @return [ ::FFI::Pointer ] The string pointer.
|
149
|
-
def string_ptr
|
150
|
-
@string_ptr ||= ::FFI::MemoryPointer.new(:pointer)
|
151
|
-
end
|
152
|
-
|
153
|
-
# Return a long pointer.
|
154
|
-
#
|
155
|
-
# @example Return a long pointer.
|
156
|
-
# Curl.long_ptr
|
157
|
-
#
|
158
|
-
# @return [ ::FFI::Pointer ] The long pointer.
|
159
|
-
def long_ptr
|
160
|
-
@long_ptr ||= ::FFI::MemoryPointer.new(:long)
|
161
|
-
end
|
162
|
-
|
163
|
-
# Return a double pointer.
|
164
|
-
#
|
165
|
-
# @example Return a double pointer.
|
166
|
-
# Curl.double_ptr
|
167
|
-
#
|
168
|
-
# @return [ ::FFI::Pointer ] The double pointer.
|
169
|
-
def double_ptr
|
170
|
-
@double_ptr ||= ::FFI::MemoryPointer.new(:double)
|
171
|
-
end
|
172
148
|
end
|
173
149
|
end
|
174
150
|
end
|
data/lib/ethon/curls/options.rb
CHANGED
@@ -41,8 +41,9 @@ module Ethon
|
|
41
41
|
opthash[option][:opts][value]
|
42
42
|
when String
|
43
43
|
opthash[option][:opts][value.to_sym]
|
44
|
-
|
45
|
-
|
44
|
+
else
|
45
|
+
value
|
46
|
+
end.to_i
|
46
47
|
when :bitmask
|
47
48
|
return if value.nil?
|
48
49
|
func=:long
|
@@ -51,8 +52,9 @@ module Ethon
|
|
51
52
|
opthash[option][:opts][value]
|
52
53
|
when Array
|
53
54
|
value.inject(0) { |res,v| res|opthash[option][:opts][v] }
|
54
|
-
|
55
|
-
|
55
|
+
else
|
56
|
+
value
|
57
|
+
end.to_i
|
56
58
|
when :string
|
57
59
|
func=:string
|
58
60
|
value=value.to_s unless value.nil?
|
@@ -408,6 +410,8 @@ module Ethon
|
|
408
410
|
option :easy, :resolve, :curl_slist, 203
|
409
411
|
option :easy, :dns_servers, :string, 211
|
410
412
|
option :easy, :accepttimeout_ms, :int, 212
|
413
|
+
option :easy, :unix_socket_path, :string, 231
|
414
|
+
option_alias :easy, :unix_socket_path, :unix_socket
|
411
415
|
## SSL and SECURITY OPTIONS
|
412
416
|
option :easy, :sslcert, :string, 25
|
413
417
|
option :easy, :sslcerttype, :string, 86
|
data/lib/ethon/easy/callbacks.rb
CHANGED
@@ -35,15 +35,12 @@ module Ethon
|
|
35
35
|
#
|
36
36
|
# @return [ Proc ] The callback.
|
37
37
|
def body_write_callback
|
38
|
-
@body_write_callback ||= proc
|
39
|
-
|
40
|
-
@headers_called = true
|
41
|
-
headers
|
42
|
-
end
|
38
|
+
@body_write_callback ||= proc do |stream, size, num, object|
|
39
|
+
headers
|
43
40
|
result = body(chunk = stream.read_string(size * num))
|
44
41
|
@response_body << chunk if result == :unyielded
|
45
|
-
result != :abort ? size*num : -1
|
46
|
-
|
42
|
+
result != :abort ? size * num : -1
|
43
|
+
end
|
47
44
|
end
|
48
45
|
|
49
46
|
# Returns the header write callback.
|
@@ -39,6 +39,8 @@ module Ethon
|
|
39
39
|
# @example Execute on_headers.
|
40
40
|
# request.headers
|
41
41
|
def headers
|
42
|
+
return if @headers_called
|
43
|
+
@headers_called = true
|
42
44
|
if defined?(@on_headers) and not @on_headers.nil?
|
43
45
|
@on_headers.each{ |callback| callback.call(self) }
|
44
46
|
end
|
@@ -61,6 +63,7 @@ module Ethon
|
|
61
63
|
# @example Execute on_completes.
|
62
64
|
# request.complete
|
63
65
|
def complete
|
66
|
+
headers unless @response_headers.empty?
|
64
67
|
if defined?(@on_complete) and not @on_complete.nil?
|
65
68
|
@on_complete.each{ |callback| callback.call(self) }
|
66
69
|
end
|
data/lib/ethon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ethon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hans Hasselberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|