http2 0.0.35 → 0.0.36
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 +4 -4
- data/lib/http2/connection.rb +1 -1
- data/lib/http2/response_reader.rb +4 -2
- data/spec/http2/cookies_spec.rb +2 -2
- data/spec/http2/post_data_generator_spec.rb +1 -1
- data/spec/http2/response_spec.rb +2 -2
- data/spec/http2/url_builder_spec.rb +1 -1
- data/spec/http2_spec.rb +16 -14
- metadata +42 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaaa3b5476a0d9233f4ef5977f64d0368f009021f92bd821280058f518463bca
|
4
|
+
data.tar.gz: 24942b90af076019fc755a6abdc61ae049ec2a7178dcad6f6df5c0aba9c5a945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb01eb1aab89764bcaa356f5c89341e926ef0ebe5818aa5b22be70e64dd0e926f6ab9807723ae15b0f33d125397be759c89d5e896ab3b25d486b312bd44e252c
|
7
|
+
data.tar.gz: 7ff240f8d775175b3b5f9fdbfe1f8a4d380c83c26729c3c31730672d5e3dbea1e8d3ccc8899f39c06f27199799243c87b8de9c6483d00ff8335fb1c279a024e5
|
data/lib/http2/connection.rb
CHANGED
@@ -132,7 +132,7 @@ class Http2::Connection
|
|
132
132
|
@sock_plain.write(@nl)
|
133
133
|
|
134
134
|
res = @sock_plain.gets.to_s
|
135
|
-
raise "Couldn't connect through proxy: #{res}" unless res.match(/^http\/1\.(0|1)\s+200/i)
|
135
|
+
raise "Couldn't connect through proxy: #{res}" unless res.match?(/^http\/1\.(0|1)\s+200/i)
|
136
136
|
|
137
137
|
@sock_plain.gets
|
138
138
|
|
@@ -103,15 +103,17 @@ private
|
|
103
103
|
@url ||= response.header("location")
|
104
104
|
end
|
105
105
|
|
106
|
+
SSL_AND_PORT_KEYS = [:ssl, :port].freeze
|
107
|
+
|
106
108
|
def url_and_args_from_location
|
107
109
|
uri = URI.parse(url)
|
108
110
|
|
109
111
|
url = uri.path
|
110
112
|
url << "?#{uri.query}" unless uri.query.to_s.empty?
|
111
|
-
url = url.
|
113
|
+
url = url.delete_prefix("/")
|
112
114
|
|
113
115
|
args = @http2.args
|
114
|
-
.reject { |k, _v|
|
116
|
+
.reject { |k, _v| SSL_AND_PORT_KEYS.include?(k) }
|
115
117
|
.merge(host: uri.host)
|
116
118
|
|
117
119
|
args[:ssl] = true if uri.scheme == "https"
|
data/spec/http2/cookies_spec.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe Http2 do
|
3
|
+
describe Http2::Cookie do
|
4
4
|
include Helpers
|
5
5
|
|
6
|
-
it "
|
6
|
+
it "parses cookies and let them be read" do
|
7
7
|
with_http do |http|
|
8
8
|
http.get("cookie_test.rhtml")
|
9
9
|
expect(http.cookies.length).to eq 2
|
data/spec/http2/response_spec.rb
CHANGED
@@ -25,14 +25,14 @@ describe Http2::Response do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
it "returns true for 'application/json'" do
|
28
|
+
it "returns true for 'application/json' and getting" do
|
29
29
|
with_http do |http|
|
30
30
|
res = http.get("json_test.rhtml")
|
31
31
|
expect(res.json?).to eq true
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
it "returns true for 'application/json'" do
|
35
|
+
it "returns true for 'application/json' and posting" do
|
36
36
|
with_http do |http|
|
37
37
|
res = http.post(url: "json_test.rhtml", post: {test: "test2"})
|
38
38
|
|
data/spec/http2_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
require "json"
|
3
3
|
|
4
4
|
describe "Http2" do
|
5
|
-
it "
|
5
|
+
it "does normal post-requests" do
|
6
6
|
# Test posting keep-alive and advanced post-data.
|
7
7
|
with_http do |http|
|
8
8
|
0.upto(5) do
|
@@ -44,17 +44,19 @@ describe "Http2" do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
describe "#reconnect" do
|
48
|
+
it "reconnects" do
|
49
|
+
with_http(follow_redirects: false, encoding_gzip: false) do |http|
|
50
|
+
resp1 = http.get("multipart_test.rhtml")
|
51
|
+
http.reconnect
|
52
|
+
resp2 = http.get("multipart_test.rhtml")
|
52
53
|
|
53
|
-
|
54
|
+
expect(resp1.body).to eq resp2.body
|
55
|
+
end
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
57
|
-
it "
|
59
|
+
it "handles multipart-requests and keep-alive when using multipart." do
|
58
60
|
with_http(follow_redirects: false) do |http|
|
59
61
|
0.upto(5) do
|
60
62
|
fpath = File.realpath(__FILE__)
|
@@ -84,7 +86,7 @@ describe "Http2" do
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
87
|
-
it "
|
89
|
+
it "handles keep-alive correctly" do
|
88
90
|
urls = [
|
89
91
|
"content_type_test.rhtml",
|
90
92
|
"json_test.rhtml"
|
@@ -100,13 +102,13 @@ describe "Http2" do
|
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
103
|
-
it "
|
105
|
+
it "raises an error when something is not found" do
|
104
106
|
with_http do |http|
|
105
107
|
expect { http.get("something_that_does_not_exist.rhtml") }.to raise_error(::Http2::Errors::Notfound)
|
106
108
|
end
|
107
109
|
end
|
108
110
|
|
109
|
-
it "
|
111
|
+
it "posts json" do
|
110
112
|
with_http do |http|
|
111
113
|
res = http.post(
|
112
114
|
url: "json_test.rhtml",
|
@@ -126,7 +128,7 @@ describe "Http2" do
|
|
126
128
|
end
|
127
129
|
end
|
128
130
|
|
129
|
-
it "
|
131
|
+
it "posts custom content types" do
|
130
132
|
with_http do |http|
|
131
133
|
res = http.post(
|
132
134
|
url: "content_type_test.rhtml",
|
@@ -142,7 +144,7 @@ describe "Http2" do
|
|
142
144
|
end
|
143
145
|
end
|
144
146
|
|
145
|
-
it "
|
147
|
+
it "sets various timeouts" do
|
146
148
|
with_http do |http|
|
147
149
|
http.get("content_type_test.rhtml")
|
148
150
|
expect(http.keepalive_timeout).to eq 15
|
@@ -150,7 +152,7 @@ describe "Http2" do
|
|
150
152
|
end
|
151
153
|
end
|
152
154
|
|
153
|
-
it "
|
155
|
+
it "follows redirects" do
|
154
156
|
with_http(follow_redirects: true) do |http|
|
155
157
|
resp = http.get("redirect_test.rhtml")
|
156
158
|
expect(resp.code).to eq "200"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: string-cases
|
@@ -136,6 +136,34 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-performance
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-rspec
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
168
|
name: sqlite3
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,21 +246,21 @@ specification_version: 4
|
|
218
246
|
summary: A lightweight framework for doing http-connections in Ruby. Supports cookies,
|
219
247
|
keep-alive, compressing and much more.
|
220
248
|
test_files:
|
249
|
+
- spec/http2/post_multipart_request_spec.rb
|
250
|
+
- spec/http2/response_reader_spec.rb
|
251
|
+
- spec/http2/get_request_spec.rb
|
252
|
+
- spec/http2/url_builder_spec.rb
|
253
|
+
- spec/http2/cookies_spec.rb
|
254
|
+
- spec/http2/post_data_generator_spec.rb
|
255
|
+
- spec/http2/post_request_spec.rb
|
256
|
+
- spec/http2/response_spec.rb
|
221
257
|
- spec/helpers.rb
|
222
258
|
- spec/http2_spec.rb
|
223
|
-
- spec/
|
259
|
+
- spec/spec_helper.rb
|
224
260
|
- spec/spec_root/json_test.rhtml
|
225
|
-
- spec/spec_root/
|
261
|
+
- spec/spec_root/unauthorized.rhtml
|
226
262
|
- spec/spec_root/redirect_test.rhtml
|
227
|
-
- spec/spec_root/multipart_test.rhtml
|
228
263
|
- spec/spec_root/cookie_test.rhtml
|
264
|
+
- spec/spec_root/content_type_test.rhtml
|
265
|
+
- spec/spec_root/multipart_test.rhtml
|
229
266
|
- spec/spec_root/unsupported_media_type.rhtml
|
230
|
-
- spec/spec_helper.rb
|
231
|
-
- spec/http2/cookies_spec.rb
|
232
|
-
- spec/http2/get_request_spec.rb
|
233
|
-
- spec/http2/url_builder_spec.rb
|
234
|
-
- spec/http2/post_multipart_request_spec.rb
|
235
|
-
- spec/http2/post_data_generator_spec.rb
|
236
|
-
- spec/http2/post_request_spec.rb
|
237
|
-
- spec/http2/response_reader_spec.rb
|
238
|
-
- spec/http2/response_spec.rb
|