async-http 0.32.0 → 0.33.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a35d727fb4d1811ad0ddea60170aef62f60084759c1c2d0f658e335f3496be4d
4
- data.tar.gz: 58004aea432052f2979346a359ad55f2d098f9fa1d9f03e4f89bd08474ced951
3
+ metadata.gz: 2072bc1fb01520b26bddf0efe77da35d52ec5c7312042b3da68a0729b17c4285
4
+ data.tar.gz: 528be9e64f5e28e00f1ed906fa88e1d6ca479be15e9f87a891b4e534f8aaa33a
5
5
  SHA512:
6
- metadata.gz: cee0898153224018a6d9a6b04b5da0635895c59aeb3f37fe5ee3fa20260529a887ee73398afa34ec98ab443a5699d0506bf40fab54123705c1f336ff7e381d72
7
- data.tar.gz: fb39c47f2edb32732b16d8a8ac3cd8158f6f78212d4dae6af2201eedc24b6bdf30085a1670b4040fb23f384b51efdf9fcaa4b09994a25c86004da9672a4104e2
6
+ metadata.gz: f396ab427ec9c93960515d5d94c0505d1750c132d69c126572c475e45e9e8206fd36e33df1b48d31e992fc342803d8c03db79a1806468fa8e04c93505e5f90ae
7
+ data.tar.gz: 46f7e9c650c278f5a04349cf357cfbe57e7da0ef756ab2f695e55d20bb5e5f505722af7ce547e2a397c2a0fbac3a2cff6a8c3cc5288de913e270d435282e70d2
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.add_dependency("async", "~> 1.6")
20
20
  spec.add_dependency("async-io", "~> 1.16")
21
21
 
22
- spec.add_dependency("http-protocol", "~> 0.5.0")
22
+ spec.add_dependency("http-protocol", "~> 0.6.0")
23
23
 
24
24
  # spec.add_dependency("openssl")
25
25
 
@@ -18,10 +18,8 @@
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_relative 'http10'
22
- require_relative 'http11'
23
-
24
- require_relative '../pool'
21
+ require_relative 'http1/client'
22
+ require_relative 'http1/server'
25
23
 
26
24
  module Async
27
25
  module HTTP
@@ -29,26 +27,12 @@ module Async
29
27
  # A server that supports both HTTP1.0 and HTTP1.1 semantics by detecting the version of the request.
30
28
  module HTTP1
31
29
  def self.client(*args)
32
- HTTP11.client(*args)
30
+ Client.new(*args)
33
31
  end
34
32
 
35
33
  def self.server(*args)
36
- HTTP11.server(*args)
34
+ Server.new(*args)
37
35
  end
38
- #
39
- # def create_handler(version)
40
- # if klass = HANDLERS[version]
41
- # klass.server(@stream)
42
- # else
43
- # raise RuntimeError, "Unsupported protocol version #{version}"
44
- # end
45
- # end
46
- #
47
- # def receive_requests(&block)
48
- # method, path, version = self.peek_line.split(/\s+/, 3)
49
- #
50
- # create_handler(version).receive_requests(&block)
51
- # end
52
36
  end
53
37
  end
54
38
  end
@@ -18,14 +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 'http/protocol/http11/connection'
22
- require_relative '../http1/connection'
21
+ require_relative 'connection'
23
22
 
24
23
  module Async
25
24
  module HTTP
26
25
  module Protocol
27
26
  module HTTP1
28
- module Client
27
+ class Client < Connection
29
28
  # Used by the client to send requests to the remote server.
30
29
  def call(request)
31
30
  Async.logger.debug(self) {"#{request.method} #{request.path} #{request.headers.inspect}"}
@@ -18,6 +18,8 @@
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/protocol/http1/connection'
22
+
21
23
  require_relative 'request'
22
24
  require_relative 'response'
23
25
 
@@ -28,7 +30,7 @@ module Async
28
30
  module HTTP
29
31
  module Protocol
30
32
  module HTTP1
31
- module Connection
33
+ class Connection < ::HTTP::Protocol::HTTP1::Connection
32
34
  CRLF = "\r\n"
33
35
 
34
36
  attr :stream
@@ -18,21 +18,20 @@
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/protocol/http11/connection'
22
- require_relative '../http1/connection'
21
+ require_relative 'connection'
23
22
 
24
23
  module Async
25
24
  module HTTP
26
25
  module Protocol
27
26
  module HTTP1
28
- module Server
27
+ class Server < Connection
29
28
  def next_request
30
29
  # The default is true.
31
30
  return nil unless @persistent
32
31
 
33
32
  request = Request.new(self)
34
33
 
35
- unless persistent?(request.headers)
34
+ unless persistent?(request.version, request.headers)
36
35
  @persistent = false
37
36
  end
38
37
 
@@ -18,8 +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_relative 'http10/client'
22
- require_relative 'http10/server'
21
+ require_relative 'http1'
23
22
 
24
23
  module Async
25
24
  module HTTP
@@ -28,11 +27,11 @@ module Async
28
27
  VERSION = "HTTP/1.0"
29
28
 
30
29
  def self.client(stream)
31
- Client.new(stream)
30
+ HTTP1::Client.new(stream, VERSION)
32
31
  end
33
32
 
34
33
  def self.server(stream)
35
- Server.new(stream)
34
+ HTTP1::Server.new(stream, VERSION)
36
35
  end
37
36
  end
38
37
  end
@@ -18,8 +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_relative 'http11/client'
22
- require_relative 'http11/server'
21
+ require_relative 'http1'
23
22
 
24
23
  module Async
25
24
  module HTTP
@@ -28,11 +27,11 @@ module Async
28
27
  VERSION = "HTTP/1.1"
29
28
 
30
29
  def self.client(stream)
31
- Client.new(stream)
30
+ HTTP1::Client.new(stream, VERSION)
32
31
  end
33
32
 
34
33
  def self.server(stream)
35
- Server.new(stream)
34
+ HTTP1::Server.new(stream, VERSION)
36
35
  end
37
36
  end
38
37
  end
@@ -18,7 +18,9 @@
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_relative 'http1'
21
+ require_relative 'http10'
22
+ require_relative 'http11'
23
+
22
24
  require_relative 'http2'
23
25
 
24
26
  require_relative '../pool'
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module HTTP
23
- VERSION = "0.32.0"
23
+ VERSION = "0.33.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.0
4
+ version: 0.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.0
47
+ version: 0.6.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: 0.5.0
54
+ version: 0.6.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: async-rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -165,11 +165,7 @@ files:
165
165
  - lib/async/http/protocol/http1/response.rb
166
166
  - lib/async/http/protocol/http1/server.rb
167
167
  - lib/async/http/protocol/http10.rb
168
- - lib/async/http/protocol/http10/client.rb
169
- - lib/async/http/protocol/http10/server.rb
170
168
  - lib/async/http/protocol/http11.rb
171
- - lib/async/http/protocol/http11/client.rb
172
- - lib/async/http/protocol/http11/server.rb
173
169
  - lib/async/http/protocol/http2.rb
174
170
  - lib/async/http/protocol/http2/client.rb
175
171
  - lib/async/http/protocol/http2/connection.rb
@@ -1,36 +0,0 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require 'http/protocol/http10/connection'
22
-
23
- require_relative '../http1/connection'
24
- require_relative '../http1/client'
25
-
26
- module Async
27
- module HTTP
28
- module Protocol
29
- module HTTP10
30
- class Client < ::HTTP::Protocol::HTTP10::Connection
31
- include HTTP1::Connection, HTTP1::Client
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,36 +0,0 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require 'http/protocol/http10/connection'
22
-
23
- require_relative '../http1/connection'
24
- require_relative '../http1/server'
25
-
26
- module Async
27
- module HTTP
28
- module Protocol
29
- module HTTP10
30
- class Server < ::HTTP::Protocol::HTTP10::Connection
31
- include HTTP1::Connection, HTTP1::Server
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,36 +0,0 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require 'http/protocol/http11/connection'
22
-
23
- require_relative '../http1/connection'
24
- require_relative '../http1/client'
25
-
26
- module Async
27
- module HTTP
28
- module Protocol
29
- module HTTP11
30
- class Client < ::HTTP::Protocol::HTTP11::Connection
31
- include HTTP1::Connection, HTTP1::Client
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,36 +0,0 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require 'http/protocol/http11/connection'
22
-
23
- require_relative '../http1/connection'
24
- require_relative '../http1/server'
25
-
26
- module Async
27
- module HTTP
28
- module Protocol
29
- module HTTP11
30
- class Server < ::HTTP::Protocol::HTTP11::Connection
31
- include HTTP1::Connection, HTTP1::Server
32
- end
33
- end
34
- end
35
- end
36
- end