async-http 0.34.2 → 0.34.3

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: 29e346514b130a63e1de8fc367ff5f85ae00469e3c9e7b41790a78381efa5a41
4
- data.tar.gz: 43b4568e84df9e1c2f836dece89bb569cbf777fe5bcf81f82850b1e36c8f4a0a
3
+ metadata.gz: 2286b4231db339b1475ba7c3cc4dadab0238bfefda06e29698b8a137c43969c1
4
+ data.tar.gz: cc8610973b007b112ef52735aa4b8553f7e4ccdbc44929c2dbecbce8c8beeef1
5
5
  SHA512:
6
- metadata.gz: 37a89c1db15f3228c5d2cf45ae1c31e83d2532e1157fa5cb9eb61c79ccb6a008d1b21c4e6672ff6dc55fdcbd9138251c9be1df2ef6da73c50ec2ca6904c59643
7
- data.tar.gz: 6d2a879574d21d1c7025a1e45458cc5350c9e0fb9b6d6ee08935fa6ca517b6af3343aefd946cd6be37687c665592e5eca0ae91cac71ba87f903403ea3f109746
6
+ metadata.gz: aaec72d53ef0f56a5220d6e7efbf027264bb926081723231ad6062ce2946099efe01cb80dae1b943faeff4fbbe6293591b97d7d2b27cd9711007037c1825ee7c
7
+ data.tar.gz: 95b4545de1b8a9e365c62803cbfbf11d712c21eb0b63c9e310c32eb7ace1b9f49dfed6041f4fe5e37efcc33742a70b6ca90ca06333df534588ef0316637a9dbf
@@ -28,11 +28,11 @@ require_relative 'middleware'
28
28
  module Async
29
29
  module HTTP
30
30
  class Client
31
- def initialize(endpoint, protocol = nil, authority = nil, retries: 3, **options)
31
+ def initialize(endpoint, protocol = endpoint.protocol, authority = endpoint.hostname, retries: 3, **options)
32
32
  @endpoint = endpoint
33
33
 
34
- @protocol = protocol || endpoint.protocol
35
- @authority = authority || endpoint.hostname
34
+ @protocol = protocol
35
+ @authority = authority
36
36
 
37
37
  @retries = retries
38
38
  @pool = connect(**options)
@@ -92,12 +92,23 @@ module Async
92
92
  end
93
93
 
94
94
  def send_request(request)
95
- headers = Headers::Merged.new({
96
- SCHEME => HTTPS,
97
- METHOD => request.method,
98
- PATH => request.path,
99
- AUTHORITY => request.authority,
100
- }, request.headers)
95
+ # https://http2.github.io/http2-spec/#rfc.section.8.1.2.3
96
+ # All HTTP/2 requests MUST include exactly one valid value for the :method, :scheme, and :path pseudo-header fields, unless it is a CONNECT request (Section 8.3). An HTTP request that omits mandatory pseudo-header fields is malformed (Section 8.1.2.6).
97
+ pseudo_headers = [
98
+ [SCHEME, HTTPS],
99
+ [METHOD, request.method],
100
+ [PATH, request.path],
101
+ ]
102
+
103
+ # To ensure that the HTTP/1.1 request line can be reproduced accurately, this pseudo-header field MUST be omitted when translating from an HTTP/1.1 request that has a request target in origin or asterisk form (see [RFC7230], Section 5.3). Clients that generate HTTP/2 requests directly SHOULD use the :authority pseudo-header field instead of the Host header field.
104
+ if authority = request.authority
105
+ pseudo_headers << [AUTHORITY, authority]
106
+ end
107
+
108
+ headers = Headers::Merged.new(
109
+ pseudo_headers,
110
+ request.headers
111
+ )
101
112
 
102
113
  if request.body.nil?
103
114
  @stream.send_headers(nil, headers, ::HTTP::Protocol::HTTP2::END_STREAM)
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module HTTP
23
- VERSION = "0.34.2"
23
+ VERSION = "0.34.3"
24
24
  end
25
25
  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.34.2
4
+ version: 0.34.3
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-10-19 00:00:00.000000000 Z
11
+ date: 2018-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async