httpx 0.13.1 → 0.13.2
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/doc/release_notes/0_13_2.md +9 -0
- data/lib/httpx/io/udp.rb +31 -7
- data/lib/httpx/plugins/aws_sigv4.rb +1 -0
- data/lib/httpx/plugins/upgrade.rb +2 -1
- data/lib/httpx/resolver/native.rb +7 -3
- data/lib/httpx/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35006c293d6a61a011056400a7934619b869ad32d9287507df8140bc9afd83fb
|
4
|
+
data.tar.gz: 62152c1c7cc0f7f330396f8e5967b4430226ba50466d6c9c829a52d4eb4902f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aef9a00cb4861ae3c4bcf32af947d5c66b9e5bdf545e2cdae30733454a3c140704e36f138857868b4c564c59bb95e16ee0fc4a33500e4035a4c872f4f78421e
|
7
|
+
data.tar.gz: a1d55b77708ada85b1ec14575ee441369cbe302d7a13e316d3f91efbf8b64a6b2c8cabaa06329759a07190858f271df88462622a2bcddd598823a7d55de61c28
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# 0.13.1
|
2
|
+
|
3
|
+
## Improvements
|
4
|
+
|
5
|
+
`UDPSocket#sendmsg_nonblock` is now used in the native resolver.
|
6
|
+
|
7
|
+
## Bugfixes
|
8
|
+
|
9
|
+
Usage in Windows was buggy, resulting in `Errno::EINVAL` during DNS resolving, when using the native resolver. This was due to a discrepancy between `recvfrom` behaviour in WS Sockets and Linux Sockets. This was fixed by making we the UDP socket never tries to receive before a DNS query has been actually sent.
|
data/lib/httpx/io/udp.rb
CHANGED
@@ -39,16 +39,20 @@ module HTTPX
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def write(buffer)
|
43
|
-
siz = @io.send(buffer.to_s, 0, @host, @port)
|
44
|
-
log { "WRITE: #{siz} bytes..." }
|
45
|
-
buffer.shift!(siz)
|
46
|
-
siz
|
47
|
-
end
|
48
|
-
|
49
42
|
# :nocov:
|
50
43
|
if (RUBY_ENGINE == "truffleruby" && RUBY_ENGINE_VERSION < "21.1.0") ||
|
51
44
|
RUBY_VERSION < "2.3"
|
45
|
+
def write(buffer)
|
46
|
+
siz = @io.sendmsg_nonblock(buffer.to_s, 0, Socket.sockaddr_in(@port, @host.to_s))
|
47
|
+
log { "WRITE: #{siz} bytes..." }
|
48
|
+
buffer.shift!(siz)
|
49
|
+
siz
|
50
|
+
rescue ::IO::WaitWritable
|
51
|
+
0
|
52
|
+
rescue EOFError
|
53
|
+
nil
|
54
|
+
end
|
55
|
+
|
52
56
|
def read(size, buffer)
|
53
57
|
data, _ = @io.recvfrom_nonblock(size)
|
54
58
|
buffer.replace(data)
|
@@ -59,6 +63,18 @@ module HTTPX
|
|
59
63
|
rescue IOError
|
60
64
|
end
|
61
65
|
else
|
66
|
+
|
67
|
+
def write(buffer)
|
68
|
+
siz = @io.sendmsg_nonblock(buffer.to_s, 0, Socket.sockaddr_in(@port, @host.to_s), exception: false)
|
69
|
+
return 0 if siz == :wait_writable
|
70
|
+
return if siz.nil?
|
71
|
+
|
72
|
+
log { "WRITE: #{siz} bytes..." }
|
73
|
+
|
74
|
+
buffer.shift!(siz)
|
75
|
+
siz
|
76
|
+
end
|
77
|
+
|
62
78
|
def read(size, buffer)
|
63
79
|
ret = @io.recvfrom_nonblock(size, 0, buffer, exception: false)
|
64
80
|
return 0 if ret == :wait_readable
|
@@ -68,6 +84,14 @@ module HTTPX
|
|
68
84
|
rescue IOError
|
69
85
|
end
|
70
86
|
end
|
87
|
+
|
88
|
+
# In JRuby, sendmsg_nonblock is not implemented
|
89
|
+
def write(buffer)
|
90
|
+
siz = @io.send(buffer.to_s, 0, @host, @port)
|
91
|
+
log { "WRITE: #{siz} bytes..." }
|
92
|
+
buffer.shift!(siz)
|
93
|
+
siz
|
94
|
+
end if RUBY_ENGINE == "jruby"
|
71
95
|
# :nocov:
|
72
96
|
end
|
73
97
|
end
|
@@ -33,7 +33,8 @@ module HTTPX
|
|
33
33
|
def fetch_response(request, connections, options)
|
34
34
|
response = super
|
35
35
|
|
36
|
-
if response
|
36
|
+
if response
|
37
|
+
return response unless response.respond_to?(:headers) && response.headers.key?("upgrade")
|
37
38
|
|
38
39
|
upgrade_protocol = response.headers["upgrade"].split(/ *, */).first
|
39
40
|
|
@@ -101,7 +101,7 @@ module HTTPX
|
|
101
101
|
transition(:open)
|
102
102
|
end
|
103
103
|
|
104
|
-
|
104
|
+
calculate_interests
|
105
105
|
end
|
106
106
|
|
107
107
|
def <<(connection)
|
@@ -127,10 +127,14 @@ module HTTPX
|
|
127
127
|
|
128
128
|
private
|
129
129
|
|
130
|
+
def calculate_interests
|
131
|
+
!@write_buffer.empty? || @queries.empty? ? :w : :r
|
132
|
+
end
|
133
|
+
|
130
134
|
def consume
|
131
|
-
dread
|
135
|
+
dread if calculate_interests == :r
|
132
136
|
do_retry
|
133
|
-
dwrite
|
137
|
+
dwrite if calculate_interests == :w
|
134
138
|
end
|
135
139
|
|
136
140
|
def do_retry
|
data/lib/httpx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -61,6 +61,7 @@ extra_rdoc_files:
|
|
61
61
|
- doc/release_notes/0_12_0.md
|
62
62
|
- doc/release_notes/0_13_0.md
|
63
63
|
- doc/release_notes/0_13_1.md
|
64
|
+
- doc/release_notes/0_13_2.md
|
64
65
|
- doc/release_notes/0_1_0.md
|
65
66
|
- doc/release_notes/0_2_0.md
|
66
67
|
- doc/release_notes/0_2_1.md
|
@@ -101,6 +102,7 @@ files:
|
|
101
102
|
- doc/release_notes/0_12_0.md
|
102
103
|
- doc/release_notes/0_13_0.md
|
103
104
|
- doc/release_notes/0_13_1.md
|
105
|
+
- doc/release_notes/0_13_2.md
|
104
106
|
- doc/release_notes/0_1_0.md
|
105
107
|
- doc/release_notes/0_2_0.md
|
106
108
|
- doc/release_notes/0_2_1.md
|