protocol-http 0.42.0 → 0.43.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: 3dcfd47b74176108bc100b7fdbb649f8fcfd09e753e268f7cf2136f4d5871eb5
4
- data.tar.gz: 68424943f3195c241b99494d21714ee5e3a4c56ed0fccefecaeb444382f74a2d
3
+ metadata.gz: 7bdd0ca9356d15e047333ae5e070710d5453bece234e484d236656edb984eb3b
4
+ data.tar.gz: eb605cfc6aa68422dd8142ba7e86fb0ec9eef55f8415e8cc0e9066af714a4aa7
5
5
  SHA512:
6
- metadata.gz: 509aa00c0dbc0a39c9641593b481b549c3b0150b4ef1372ae7deb1468b43027399f1f024ae7c26ca30c06eb3ce46bb8720da613b199070fac03d5607e15f1d2e
7
- data.tar.gz: 438fcedcbda571ba5f3d9e800105669801123444d359c9915a4c90ba2cd3139e17e3b40c116750ae0f731a2eb6094a99c447b6f62a7978d4bc7d4c8015e95538
6
+ metadata.gz: 493688f8e6e8a417bfdb49fd53103e07ccca2f164613e5cea2ce0298b4eb4c4e251add7c1873d178f38b1cfb984267e277c4388f60b9e36b013d1f8bac950b57
7
+ data.tar.gz: '0590a15ef7f6447efc5c84a0c6ce7e796a1b1b8d91975b10f895a5c0d9c450402f7adeb7b504785179e6fe68f776a7113050adc2458dc84e7f4330b6faec4774'
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
+
6
+ module Protocol
7
+ module HTTP
8
+ # Provide a well defined, cached representation of a peer (address).
9
+ class Peer
10
+ def self.for(io)
11
+ if address = io.remote_address
12
+ return new(address)
13
+ end
14
+ end
15
+
16
+ def initialize(address)
17
+ @address = address
18
+
19
+ if address.ip?
20
+ @ip_address = @address.ip_address
21
+ end
22
+ end
23
+
24
+ attr :address
25
+ attr :ip_address
26
+
27
+ alias remote_address address
28
+ end
29
+ end
30
+ end
@@ -64,6 +64,13 @@ module Protocol
64
64
  # @attribute [Proc] a callback which is called when an interim response is received.
65
65
  attr_accessor :interim_response
66
66
 
67
+ # A request that is generated by a server, may choose to include the peer (address) associated with the request. It should be implemented by a sub-class.
68
+ #
69
+ # @returns [Peer | Nil] The peer (address) associated with the request.
70
+ def peer
71
+ nil
72
+ end
73
+
67
74
  # Send the request to the given connection.
68
75
  def call(connection)
69
76
  connection.call(self)
@@ -52,6 +52,13 @@ module Protocol
52
52
  # @attribute [String | Array(String) | Nil] The protocol, e.g. `"websocket"`, etc.
53
53
  attr_accessor :protocol
54
54
 
55
+ # A response that is generated by a client, may choose to include the peer (address) associated with the response. It should be implemented by a sub-class.
56
+ #
57
+ # @returns [Peer | Nil] The peer (address) associated with the response.
58
+ def peer
59
+ nil
60
+ end
61
+
55
62
  # Whether the response is considered a hijack: the connection has been taken over by the application and the server should not send any more data.
56
63
  def hijack?
57
64
  false
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP
8
- VERSION = "0.42.0"
8
+ VERSION = "0.43.0"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.42.0
4
+ version: 0.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -47,7 +47,7 @@ cert_chain:
47
47
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
48
48
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
49
49
  -----END CERTIFICATE-----
50
- date: 2024-10-21 00:00:00.000000000 Z
50
+ date: 2024-11-09 00:00:00.000000000 Z
51
51
  dependencies: []
52
52
  description:
53
53
  email:
@@ -88,6 +88,7 @@ files:
88
88
  - lib/protocol/http/methods.rb
89
89
  - lib/protocol/http/middleware.rb
90
90
  - lib/protocol/http/middleware/builder.rb
91
+ - lib/protocol/http/peer.rb
91
92
  - lib/protocol/http/reference.rb
92
93
  - lib/protocol/http/request.rb
93
94
  - lib/protocol/http/response.rb
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubygems_version: 3.5.11
121
+ rubygems_version: 3.5.22
121
122
  signing_key:
122
123
  specification_version: 4
123
124
  summary: Provides abstractions to handle HTTP protocols.
metadata.gz.sig CHANGED
Binary file