async-http 0.38.3 → 0.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/async-http.gemspec +3 -1
- data/lib/async/http/headers.rb +2 -2
- data/lib/async/http/protocol/http1/connection.rb +2 -2
- data/lib/async/http/protocol/http2.rb +9 -9
- data/lib/async/http/protocol/http2/client.rb +3 -3
- data/lib/async/http/protocol/http2/request.rb +2 -2
- data/lib/async/http/protocol/http2/response.rb +1 -1
- data/lib/async/http/protocol/http2/server.rb +4 -4
- data/lib/async/http/protocol/http2/stream.rb +3 -3
- data/lib/async/http/reference.rb +2 -2
- data/lib/async/http/statistics.rb +1 -1
- data/lib/async/http/version.rb +1 -1
- data/tasks/server.rake +4 -4
- metadata +34 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d2ae06b181bb3fc7bca37de3c13361d9cf06c033f5ca0a4221cd1afb32108f7
|
4
|
+
data.tar.gz: 2e91385f85f2a2710ea7fa4490b04f01272f7cf525b24581cfe774683eb625a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ed6969ab041fd96096c6e445d1fba0774d7de57546c98d1b241a27f46328fae44eb331bff08febb0175457c62f46447070f9eb25afe4c1de84d9786bff99379
|
7
|
+
data.tar.gz: 80b2ad6e10754ed1eb99d244f838f45fa9f8478273ce740ea922ed1abd4a0180d324fe9c4a968f152bbded8ff6f8483ab0fe8e13d4ddeab5f961070a077f3217
|
data/.travis.yml
CHANGED
data/async-http.gemspec
CHANGED
@@ -19,7 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.add_dependency("async", "~> 1.14")
|
20
20
|
spec.add_dependency("async-io", "~> 1.18")
|
21
21
|
|
22
|
-
spec.add_dependency("http
|
22
|
+
spec.add_dependency("protocol-http", "~> 0.1.0")
|
23
|
+
spec.add_dependency("protocol-http1", "~> 0.1.0")
|
24
|
+
spec.add_dependency("protocol-http2", "~> 0.1.0")
|
23
25
|
|
24
26
|
# spec.add_dependency("openssl")
|
25
27
|
|
data/lib/async/http/headers.rb
CHANGED
@@ -18,10 +18,10 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
require 'http/
|
21
|
+
require 'protocol/http/headers'
|
22
22
|
|
23
23
|
module Async
|
24
24
|
module HTTP
|
25
|
-
Headers = ::HTTP::
|
25
|
+
Headers = ::Protocol::HTTP::Headers
|
26
26
|
end
|
27
27
|
end
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
require '
|
21
|
+
require 'protocol/http1'
|
22
22
|
|
23
23
|
require_relative 'request'
|
24
24
|
require_relative 'response'
|
@@ -30,7 +30,7 @@ module Async
|
|
30
30
|
module HTTP
|
31
31
|
module Protocol
|
32
32
|
module HTTP1
|
33
|
-
class Connection < ::
|
33
|
+
class Connection < ::Protocol::HTTP1::Connection
|
34
34
|
def initialize(stream, version)
|
35
35
|
super(stream)
|
36
36
|
|
@@ -26,18 +26,18 @@ module Async
|
|
26
26
|
module Protocol
|
27
27
|
module HTTP2
|
28
28
|
CLIENT_SETTINGS = {
|
29
|
-
::
|
30
|
-
::
|
31
|
-
::
|
32
|
-
::
|
29
|
+
::Protocol::HTTP2::Settings::ENABLE_PUSH => 0,
|
30
|
+
::Protocol::HTTP2::Settings::MAXIMUM_CONCURRENT_STREAMS => 256,
|
31
|
+
::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000,
|
32
|
+
::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x7FFFFFFF,
|
33
33
|
}
|
34
34
|
|
35
35
|
SERVER_SETTINGS = {
|
36
|
-
::
|
36
|
+
::Protocol::HTTP2::Settings::ENABLE_PUSH => 1,
|
37
37
|
# We choose a lower maximum concurrent streams to avoid overloading a single connection/thread.
|
38
|
-
::
|
39
|
-
::
|
40
|
-
::
|
38
|
+
::Protocol::HTTP2::Settings::MAXIMUM_CONCURRENT_STREAMS => 32,
|
39
|
+
::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000,
|
40
|
+
::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x7FFFFFFF,
|
41
41
|
}
|
42
42
|
|
43
43
|
def self.client(stream, settings = CLIENT_SETTINGS)
|
@@ -60,7 +60,7 @@ module Async
|
|
60
60
|
|
61
61
|
module WithPush
|
62
62
|
CLIENT_SETTINGS = HTTP2::CLIENT_SETTINGS.merge(
|
63
|
-
::
|
63
|
+
::Protocol::HTTP2::Settings::ENABLE_PUSH => 1,
|
64
64
|
)
|
65
65
|
|
66
66
|
def self.client(stream, settings = CLIENT_SETTINGS)
|
@@ -21,19 +21,19 @@
|
|
21
21
|
require_relative 'connection'
|
22
22
|
require_relative 'response'
|
23
23
|
|
24
|
-
require '
|
24
|
+
require 'protocol/http2/client'
|
25
25
|
|
26
26
|
module Async
|
27
27
|
module HTTP
|
28
28
|
module Protocol
|
29
29
|
module HTTP2
|
30
|
-
class Client < ::
|
30
|
+
class Client < ::Protocol::HTTP2::Client
|
31
31
|
include Connection
|
32
32
|
|
33
33
|
def initialize(stream)
|
34
34
|
@stream = stream
|
35
35
|
|
36
|
-
framer = ::
|
36
|
+
framer = ::Protocol::HTTP2::Framer.new(@stream)
|
37
37
|
|
38
38
|
super(framer)
|
39
39
|
end
|
@@ -128,7 +128,7 @@ module Async
|
|
128
128
|
|
129
129
|
def send_response(response)
|
130
130
|
if response.nil?
|
131
|
-
@stream.send_headers(nil, NO_RESPONSE, ::
|
131
|
+
@stream.send_headers(nil, NO_RESPONSE, ::Protocol::HTTP2::END_STREAM)
|
132
132
|
elsif response.body?
|
133
133
|
pseudo_headers = [
|
134
134
|
[STATUS, response.status],
|
@@ -150,7 +150,7 @@ module Async
|
|
150
150
|
[STATUS, response.status],
|
151
151
|
], response.headers)
|
152
152
|
|
153
|
-
@stream.send_headers(nil, headers, ::
|
153
|
+
@stream.send_headers(nil, headers, ::Protocol::HTTP2::END_STREAM)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
@@ -22,19 +22,19 @@ require_relative 'connection'
|
|
22
22
|
require_relative 'request'
|
23
23
|
require_relative 'promise'
|
24
24
|
|
25
|
-
require '
|
25
|
+
require 'protocol/http2/server'
|
26
26
|
|
27
27
|
module Async
|
28
28
|
module HTTP
|
29
29
|
module Protocol
|
30
30
|
module HTTP2
|
31
|
-
class Server < ::
|
31
|
+
class Server < ::Protocol::HTTP2::Server
|
32
32
|
include Connection
|
33
33
|
|
34
34
|
def initialize(stream)
|
35
35
|
@stream = stream
|
36
36
|
|
37
|
-
framer = ::
|
37
|
+
framer = ::Protocol::HTTP2::Framer.new(stream)
|
38
38
|
|
39
39
|
super(framer)
|
40
40
|
|
@@ -63,7 +63,7 @@ module Async
|
|
63
63
|
response = begin
|
64
64
|
response = yield(request)
|
65
65
|
rescue
|
66
|
-
request.stream.send_reset_stream(::
|
66
|
+
request.stream.send_reset_stream(::Protocol::HTTP2::INTERNAL_ERROR)
|
67
67
|
|
68
68
|
Async.logger.error(request) {$!}
|
69
69
|
else
|
@@ -18,13 +18,13 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
require '
|
21
|
+
require 'protocol/http2/stream'
|
22
22
|
|
23
23
|
module Async
|
24
24
|
module HTTP
|
25
25
|
module Protocol
|
26
26
|
module HTTP2
|
27
|
-
class Stream < ::
|
27
|
+
class Stream < ::Protocol::HTTP2::Stream
|
28
28
|
def initialize(delegate, *args)
|
29
29
|
super(*args)
|
30
30
|
|
@@ -80,7 +80,7 @@ module Async
|
|
80
80
|
|
81
81
|
# @body.read above might take a while and a stream reset might be received in the mean time.
|
82
82
|
unless closed?
|
83
|
-
send_data(nil, ::
|
83
|
+
send_data(nil, ::Protocol::HTTP2::END_STREAM)
|
84
84
|
end
|
85
85
|
|
86
86
|
return false
|
data/lib/async/http/reference.rb
CHANGED
@@ -18,10 +18,10 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
require 'http/
|
21
|
+
require 'protocol/http/reference'
|
22
22
|
|
23
23
|
module Async
|
24
24
|
module HTTP
|
25
|
-
Reference = ::HTTP::
|
25
|
+
Reference = ::Protocol::HTTP::Reference
|
26
26
|
end
|
27
27
|
end
|
data/lib/async/http/version.rb
CHANGED
data/tasks/server.rake
CHANGED
@@ -22,17 +22,17 @@ task :google do
|
|
22
22
|
peer = endpoint.connect
|
23
23
|
stream = Async::IO::Stream.new(peer)
|
24
24
|
|
25
|
-
framer = ::
|
26
|
-
client = ::
|
25
|
+
framer = ::Protocol::HTTP2::Framer.new(stream)
|
26
|
+
client = ::Protocol::HTTP2::Client.new(framer)
|
27
27
|
|
28
28
|
client.send_connection_preface
|
29
29
|
|
30
|
-
stream = ::
|
30
|
+
stream = ::Protocol::HTTP2::Stream.new(client)
|
31
31
|
|
32
32
|
client.read_frame
|
33
33
|
client.read_frame
|
34
34
|
|
35
|
-
stream.send_headers(nil, [[':method', 'GET'], [':authority', 'www.google.com'], [':path', '/']], ::
|
35
|
+
stream.send_headers(nil, [[':method', 'GET'], [':authority', 'www.google.com'], [':path', '/']], ::Protocol::HTTP2::END_STREAM)
|
36
36
|
|
37
37
|
binding.pry
|
38
38
|
end
|
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.39.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: 2019-05-
|
11
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -39,19 +39,47 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.18'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: http
|
42
|
+
name: protocol-http
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: protocol-http1
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.1.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: protocol-http2
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.0
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: async-rspec
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -221,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
249
|
- !ruby/object:Gem::Version
|
222
250
|
version: '0'
|
223
251
|
requirements: []
|
224
|
-
rubygems_version: 3.0.
|
252
|
+
rubygems_version: 3.0.3
|
225
253
|
signing_key:
|
226
254
|
specification_version: 4
|
227
255
|
summary: A HTTP client and server library.
|