httpx 0.1.0 → 0.2.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 +4 -4
- data/README.md +4 -0
- data/lib/httpx/buffer.rb +2 -0
- data/lib/httpx/chainable.rb +5 -5
- data/lib/httpx/channel/http2.rb +22 -3
- data/lib/httpx/channel.rb +74 -20
- data/lib/httpx/client.rb +33 -23
- data/lib/httpx/connection.rb +77 -9
- data/lib/httpx/errors.rb +4 -0
- data/lib/httpx/io/ssl.rb +19 -1
- data/lib/httpx/io/tcp.rb +25 -7
- data/lib/httpx/io/udp.rb +56 -0
- data/lib/httpx/io/unix.rb +4 -1
- data/lib/httpx/io.rb +2 -0
- data/lib/httpx/options.rb +3 -2
- data/lib/httpx/plugins/proxy.rb +14 -11
- data/lib/httpx/resolver/https.rb +181 -0
- data/lib/httpx/resolver/native.rb +251 -0
- data/lib/httpx/resolver/options.rb +25 -0
- data/lib/httpx/resolver/resolver_mixin.rb +61 -0
- data/lib/httpx/resolver/system.rb +34 -0
- data/lib/httpx/resolver.rb +103 -0
- data/lib/httpx/response.rb +8 -1
- data/lib/httpx/selector.rb +10 -4
- data/lib/httpx/timeout.rb +1 -1
- data/lib/httpx/version.rb +1 -1
- metadata +9 -2
data/lib/httpx/response.rb
CHANGED
@@ -108,7 +108,14 @@ module HTTPX
|
|
108
108
|
|
109
109
|
def to_s
|
110
110
|
rewind
|
111
|
-
|
111
|
+
if @buffer
|
112
|
+
content = @buffer.read
|
113
|
+
begin
|
114
|
+
return content.force_encoding(@encoding)
|
115
|
+
rescue ArgumentError # ex: unknown encoding name - utf
|
116
|
+
return content
|
117
|
+
end
|
118
|
+
end
|
112
119
|
""
|
113
120
|
ensure
|
114
121
|
close
|
data/lib/httpx/selector.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class HTTPX::Selector
|
4
|
+
READABLE = %i[rw r].freeze
|
5
|
+
WRITABLE = %i[rw w].freeze
|
6
|
+
|
7
|
+
private_constant :READABLE
|
8
|
+
private_constant :WRITABLE
|
9
|
+
|
4
10
|
#
|
5
11
|
# I/O monitor
|
6
12
|
#
|
@@ -15,11 +21,11 @@ class HTTPX::Selector
|
|
15
21
|
end
|
16
22
|
|
17
23
|
def readable?
|
18
|
-
@interests
|
24
|
+
READABLE.include?(@interests)
|
19
25
|
end
|
20
26
|
|
21
27
|
def writable?
|
22
|
-
@interests
|
28
|
+
WRITABLE.include?(@interests)
|
23
29
|
end
|
24
30
|
|
25
31
|
# closes +@io+, deregisters from reactor (unless +deregister+ is false)
|
@@ -60,8 +66,8 @@ class HTTPX::Selector
|
|
60
66
|
|
61
67
|
# register +io+ for +interests+ events.
|
62
68
|
def register(io, interests)
|
63
|
-
readable = interests
|
64
|
-
writable = interests
|
69
|
+
readable = READABLE.include?(interests)
|
70
|
+
writable = WRITABLE.include?(interests)
|
65
71
|
@lock.synchronize do
|
66
72
|
if readable
|
67
73
|
monitor = @readers[io]
|
data/lib/httpx/timeout.rb
CHANGED
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- lib/httpx/io.rb
|
97
97
|
- lib/httpx/io/ssl.rb
|
98
98
|
- lib/httpx/io/tcp.rb
|
99
|
+
- lib/httpx/io/udp.rb
|
99
100
|
- lib/httpx/io/unix.rb
|
100
101
|
- lib/httpx/loggable.rb
|
101
102
|
- lib/httpx/options.rb
|
@@ -118,6 +119,12 @@ files:
|
|
118
119
|
- lib/httpx/plugins/stream.rb
|
119
120
|
- lib/httpx/registry.rb
|
120
121
|
- lib/httpx/request.rb
|
122
|
+
- lib/httpx/resolver.rb
|
123
|
+
- lib/httpx/resolver/https.rb
|
124
|
+
- lib/httpx/resolver/native.rb
|
125
|
+
- lib/httpx/resolver/options.rb
|
126
|
+
- lib/httpx/resolver/resolver_mixin.rb
|
127
|
+
- lib/httpx/resolver/system.rb
|
121
128
|
- lib/httpx/response.rb
|
122
129
|
- lib/httpx/selector.rb
|
123
130
|
- lib/httpx/timeout.rb
|