async-http 0.29.0 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfeb33367d8c8e3f81277eaa35ca8e9d63c3112ae00328a0636b9f6f8e18178f
|
4
|
+
data.tar.gz: '08f4c3632dc8d1d22160b2e57cb4aad1d55f238825ef0d9a5d8fe772d0ae4a50'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4362e549d79ba747c21c8edafa4e92f20a158443d985e064bb22e53a7b34867c4f40fc3d207d457f5014d119c16fe5622b23939a9898438ae0031c45c922f8b1
|
7
|
+
data.tar.gz: 71d48ae5803cd1e7d77c233163aef78cd0b28cd2c240e5b5ee5a464efb58fb3f6ed00e5b593d50d3e302d2fb9815ec031706364a1fff17b01a36b0f3e6bb8152
|
data/README.md
CHANGED
@@ -39,15 +39,13 @@ require 'async/reactor'
|
|
39
39
|
require 'async/http/url_endpoint'
|
40
40
|
require 'async/http/response'
|
41
41
|
|
42
|
-
endpoint = Async::HTTP::URLEndpoint.parse('http://127.0.0.1:9294'
|
42
|
+
endpoint = Async::HTTP::URLEndpoint.parse('http://127.0.0.1:9294')
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
Async::HTTP::Response[200, {}, ["Hello World"]]
|
47
|
-
end
|
44
|
+
app = lambda do |request|
|
45
|
+
Async::HTTP::Response[200, {}, ["Hello World"]]
|
48
46
|
end
|
49
47
|
|
50
|
-
server = Server.new(endpoint)
|
48
|
+
server = Async::HTTP::Server.new(app, endpoint)
|
51
49
|
client = Async::HTTP::Client.new(endpoint)
|
52
50
|
|
53
51
|
Async::Reactor.run do |task|
|
@@ -55,7 +53,9 @@ Async::Reactor.run do |task|
|
|
55
53
|
server.run
|
56
54
|
end
|
57
55
|
|
58
|
-
response = client.get("/"
|
56
|
+
response = client.get("/")
|
57
|
+
|
58
|
+
puts response.status
|
59
59
|
puts response.read
|
60
60
|
|
61
61
|
server_task.stop
|
@@ -41,6 +41,8 @@ module Async
|
|
41
41
|
@reader = nil
|
42
42
|
end
|
43
43
|
|
44
|
+
attr :stream
|
45
|
+
|
44
46
|
def start_connection
|
45
47
|
@reader ||= read_in_background
|
46
48
|
end
|
@@ -49,11 +51,13 @@ module Async
|
|
49
51
|
task.async do |nested_task|
|
50
52
|
nested_task.annotate("#{version} reading data")
|
51
53
|
|
52
|
-
|
53
|
-
self.
|
54
|
+
begin
|
55
|
+
while !self.closed?
|
56
|
+
self.read_frame
|
57
|
+
end
|
58
|
+
rescue
|
59
|
+
Async.logger.debug(self) {$!}
|
54
60
|
end
|
55
|
-
|
56
|
-
Async.logger.debug(self) {"Connection reset by peer!"}
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
@@ -31,8 +31,9 @@ module Async
|
|
31
31
|
include Connection
|
32
32
|
|
33
33
|
def initialize(stream, *args)
|
34
|
-
|
34
|
+
@stream = stream
|
35
35
|
|
36
|
+
framer = ::HTTP::Protocol::HTTP2::Framer.new(stream)
|
36
37
|
super(framer, *args)
|
37
38
|
|
38
39
|
@requests = Async::Queue.new
|
@@ -84,13 +84,27 @@ module Async
|
|
84
84
|
@options[:alpn_protocols] || DEFAULT_ALPN_PROTOCOLS
|
85
85
|
end
|
86
86
|
|
87
|
+
LOCALHOST = 'localhost'.freeze
|
88
|
+
|
89
|
+
# We don't try to validate peer certificates when talking to localhost because they would always be self-signed.
|
90
|
+
def ssl_verify_mode
|
91
|
+
case self.hostname
|
92
|
+
when LOCALHOST
|
93
|
+
OpenSSL::SSL::VERIFY_NONE
|
94
|
+
else
|
95
|
+
OpenSSL::SSL::VERIFY_PEER
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
87
99
|
def ssl_context
|
88
100
|
@options[:ssl_context] || ::OpenSSL::SSL::SSLContext.new.tap do |context|
|
89
101
|
if alpn_protocols = self.alpn_protocols
|
90
102
|
context.alpn_protocols = alpn_protocols
|
91
103
|
end
|
92
104
|
|
93
|
-
context.set_params
|
105
|
+
context.set_params(
|
106
|
+
verify_mode: self.ssl_verify_mode
|
107
|
+
)
|
94
108
|
end
|
95
109
|
end
|
96
110
|
|
data/lib/async/http/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.30.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|