ethon 0.9.1 → 0.10.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5b8550d86c3b12a213c5f44bc47575cc155b57f
4
- data.tar.gz: 9c23490c1d3184612dea6e1e88a293a7444f65a6
3
+ metadata.gz: 612df63c107484c065be684be2f9d9c0b228a371
4
+ data.tar.gz: 906f70fe6d048a0b3e8022ad24d704996c18bb90
5
5
  SHA512:
6
- metadata.gz: 8dfc9939d7232e54526cd3aebcda6a8c058d0620efcd50204e6e9d9b19c40484a4ee117a1b64761f5bdefd130ea0842a169dc5ddb108f6b73ddb325748db5e74
7
- data.tar.gz: 4abc8b70ff4da5bce7edf2e7ea75c22bab080ea68f211618bc350bad55ab8df1ad7e1dd8f304dcdb85a21499b524f7ff40d064e7a42ad7175b1b787f7e0a576a
6
+ metadata.gz: 614883cb82bd35ffe340e9e2b9d091726d8345d8b293b2a4efbfaed7244b181c2657543dcc4824af8e2fc347b32029b2e84ac9069edc6c0e58d92191eda97dd9
7
+ data.tar.gz: 6bb002290d0e5ca932f2f90a79eb05d96942582fdff2cb6f86febfdfc932b8e6e48437716017cfd8e6e014a7fe765ec1f4259239023e461c211fbd823c109dcd
@@ -18,7 +18,6 @@ rvm:
18
18
  - jruby-18mode
19
19
  - jruby-19mode
20
20
  - jruby-head
21
- - rbx-2
22
21
 
23
22
  matrix:
24
23
  allow_failures:
@@ -2,7 +2,11 @@
2
2
 
3
3
  ## Master
4
4
 
5
- [Full Changelog](https://github.com/typhoeus/ethon/compare/v0.9.1...master)
5
+ [Full Changelog](https://github.com/typhoeus/ethon/compare/v0.10.0...master)
6
+
7
+ ## 0.10.0
8
+
9
+ [Full Changelog](https://github.com/typhoeus/ethon/compare/v0.9.1...v0.10.0)
6
10
 
7
11
  ## 0.9.1
8
12
 
@@ -335,7 +335,7 @@ module Ethon
335
335
  option :easy, :cookiesession, :bool, 96
336
336
  option :easy, :cookielist, :string, 135
337
337
  option :easy, :httpget, :bool, 80
338
- option :easy, :http_version, :enum, 84, [:none, :httpv1_0, :httpv1_1]
338
+ option :easy, :http_version, :enum, 84, [:none, :httpv1_0, :httpv1_1, :httpv2_0]
339
339
  option :easy, :ignore_content_length, :bool, 136
340
340
  option :easy, :http_content_decoding, :bool, 158
341
341
  option :easy, :http_transfer_decoding, :bool, 157
@@ -82,8 +82,8 @@ module Ethon
82
82
  Curl.formadd(first, last,
83
83
  :form_option, :copyname, :pointer, name,
84
84
  :form_option, :namelength, :long, name.bytesize,
85
- :form_option, :copycontents, :pointer, content,
86
- :form_option, :contentslength, :long, content ? content.bytesize : 0,
85
+ :form_option, :copycontents, :pointer, content.to_s,
86
+ :form_option, :contentslength, :long, content ? content.to_s.bytesize : 0,
87
87
  :form_option, :end
88
88
  )
89
89
  end
@@ -4,6 +4,8 @@ module Ethon
4
4
  #
5
5
  # @api private
6
6
  module Header
7
+ EMPTY_STRING_VALUE = "".freeze
8
+
7
9
  # Return headers, return empty hash if none.
8
10
  #
9
11
  # @example Return the headers.
@@ -53,7 +55,11 @@ module Ethon
53
55
  #
54
56
  # @return [ String ] The composed header.
55
57
  def compose_header(key, value)
56
- Util.escape_zero_byte("#{key}: #{value}")
58
+ if(value == EMPTY_STRING_VALUE)
59
+ Util.escape_zero_byte("#{key};")
60
+ else
61
+ Util.escape_zero_byte("#{key}: #{value}")
62
+ end
57
63
  end
58
64
  end
59
65
  end
@@ -1,5 +1,5 @@
1
1
  module Ethon
2
2
 
3
3
  # Ethon version.
4
- VERSION = '0.9.1'
4
+ VERSION = '0.10.0'
5
5
  end
@@ -72,5 +72,23 @@ describe Ethon::Easy::Form do
72
72
  form.materialize
73
73
  end
74
74
  end
75
+
76
+ context "when query_pairs contains file and string values" do
77
+ let(:pairs) { [['a', ["file", "type", "path/file"]], ['b', '1']] }
78
+
79
+ it "adds file to form" do
80
+ expect(Ethon::Curl).to receive(:formadd).twice
81
+ form.materialize
82
+ end
83
+ end
84
+
85
+ context "when query_pairs contains file, string and int values" do
86
+ let(:pairs) { [['a', ["file", "type", "path/file"]], ['b', '1'], ['c', 1]] }
87
+
88
+ it "adds file to form" do
89
+ expect(Ethon::Curl).to receive(:formadd).exactly(3).times
90
+ form.materialize
91
+ end
92
+ end
75
93
  end
76
94
  end
@@ -46,6 +46,36 @@ describe Ethon::Easy::Header do
46
46
  expect(easy.response_body).to include('"HTTP_USER_AGENT":"Ethon"')
47
47
  end
48
48
  end
49
+
50
+ context "when header value is empty string" do
51
+ let(:headers) { { 'User-Agent' => "" } }
52
+
53
+ if(Ethon::Curl.version_info[:version] >= "7.23.0")
54
+ it "sends header with empty value" do
55
+ expect(easy.response_body).to include('"HTTP_USER_AGENT":""')
56
+ end
57
+ else
58
+ it "does not send header (curl < 7.23.0 does not support empty values)" do
59
+ expect(easy.response_body).to_not include('"HTTP_USER_AGENT"')
60
+ end
61
+ end
62
+ end
63
+
64
+ context "when header value is nil" do
65
+ let(:headers) { { 'User-Agent' => nil } }
66
+
67
+ it "does not send header" do
68
+ expect(easy.response_body).to_not include('"HTTP_USER_AGENT"')
69
+ end
70
+ end
71
+
72
+ context "when header value is integer" do
73
+ let(:headers) { { 'User-Agent' => 0 } }
74
+
75
+ it "sends as string" do
76
+ expect(easy.response_body).to include('"HTTP_USER_AGENT":"0"')
77
+ end
78
+ end
49
79
  end
50
80
  end
51
81
 
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.1
4
+ version: 0.10.0
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-09-20 00:00:00.000000000 Z
11
+ date: 2016-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi