raptor 0.10.0 → 0.12.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.
@@ -64,6 +64,18 @@ module Raptor
64
64
 
65
65
  ILLEGAL_HEADER_VALUE_REGEX: ::Regexp
66
66
 
67
+ CHUNK_SIZE_REGEX: ::Regexp
68
+
69
+ # Returns true when an HTTP/1.1 request lacks a valid `Host` header per
70
+ # RFC 9112 section 3.2, where a valid value is a non-empty single-value
71
+ # line.
72
+ #
73
+ # @param env [Hash] the Rack environment after header parsing
74
+ # @return [Boolean]
75
+ #
76
+ # @rbs (Hash[String, untyped] env) -> bool
77
+ def self.invalid_host?: (Hash[String, untyped] env) -> bool
78
+
67
79
  # Returns true when the message framing shows a request-smuggling vector
68
80
  # per RFC 9112 section 6.3: a `Transfer-Encoding` where `chunked` is
69
81
  # missing, not the final encoding, or duplicated; a `Transfer-Encoding`
@@ -79,9 +91,10 @@ module Raptor
79
91
  # Decodes a chunked transfer-encoded body buffer.
80
92
  #
81
93
  # Returns the decoded bytes and a state symbol: `:complete` when the
82
- # terminating zero-length chunk was found, `:too_large` when the decoded
83
- # size would exceed `max_size`, `:malformed` when chunk framing overhead
84
- # exceeds `MAX_CHUNK_OVERHEAD`, or `:incomplete` otherwise.
94
+ # terminating zero-length chunk and trailer section were fully consumed,
95
+ # `:too_large` when the decoded size would exceed `max_size`, `:malformed`
96
+ # when a chunk-size line is not valid hex or chunk framing overhead exceeds
97
+ # `MAX_CHUNK_OVERHEAD`, or `:incomplete` otherwise.
85
98
  #
86
99
  # @param buffer [String] the raw body buffer to decode
87
100
  # @param max_size [Integer, nil] maximum decoded body size, or nil for unlimited
@@ -579,8 +592,8 @@ module Raptor
579
592
  # @param headers [Hash] normalized response headers
580
593
  # @return [String] formatted header lines, each ending with CRLF
581
594
  #
582
- # @rbs (Hash[String, String | Array[String]] headers) -> String
583
- def format_headers: (Hash[String, String | Array[String]] headers) -> String
595
+ # @rbs (String result, Hash[String, String | Array[String]] headers) -> void
596
+ def format_headers: (String result, Hash[String, String | Array[String]] headers) -> void
584
597
 
585
598
  # Appends one or more `name: value` header lines to `result`. Newline-
586
599
  # separated values are emitted as separate lines; empty values and values
@@ -145,6 +145,22 @@ module Raptor
145
145
 
146
146
  HOP_BY_HOP_HEADERS: untyped
147
147
 
148
+ REQUEST_PSEUDO_HEADERS: untyped
149
+
150
+ REQUIRED_REQUEST_PSEUDO_HEADERS: untyped
151
+
152
+ # Returns true when a decoded header block violates the HTTP/2 pseudo-header
153
+ # rules from RFC 9113 section 8.3: an unknown pseudo-header, a duplicate
154
+ # pseudo-header, a pseudo-header appearing after any regular header, or a
155
+ # required pseudo-header (`:method`, `:scheme`, `:path`) missing on
156
+ # non-`CONNECT` requests.
157
+ #
158
+ # @param headers [Array<Array(String, String)>] decoded header pairs
159
+ # @return [Boolean]
160
+ #
161
+ # @rbs (Array[[String, String]] headers) -> bool
162
+ def self.invalid_pseudo_headers?: (Array[[ String, String ]] headers) -> bool
163
+
148
164
  @initial_settings_frame: String
149
165
 
150
166
  @on_error: ^(Hash[String, untyped]?, Exception) -> void | nil
@@ -52,5 +52,14 @@ module Raptor
52
52
  #
53
53
  # @rbs (Integer backlog) -> void
54
54
  def self.update_load: (Integer backlog) -> void
55
+
56
+ # Marks a worker's slot as unavailable by parking its load at the
57
+ # sentinel maximum so the BPF program's least-loaded pick skips it.
58
+ #
59
+ # @param worker_index [Integer] slot index for the worker to mark
60
+ # @return [void]
61
+ #
62
+ # @rbs (Integer worker_index) -> void
63
+ def self.mark_unavailable: (Integer worker_index) -> void
55
64
  end
56
65
  end
@@ -82,11 +82,17 @@ module Raptor
82
82
  # @rbs () -> Thread
83
83
  def run: () -> Thread
84
84
 
85
- # Gracefully shuts down the server.
85
+ # Stops the accept loop and, when `drain_accept_queue` is enabled,
86
+ # dispatches every connection already in the kernel accept queue. Leaves
87
+ # the listening sockets open so they can be handed to replacement workers.
86
88
  #
87
- # Stops accepting new connections and closes all listening sockets. When
88
- # `drain_accept_queue` is enabled, dispatches every connection already in
89
- # the kernel accept queue before closing the listeners.
89
+ # @return [void]
90
+ #
91
+ # @rbs () -> void
92
+ def stop_accepting: () -> void
93
+
94
+ # Gracefully shuts down the server, stopping the accept loop and closing
95
+ # all listening sockets.
90
96
  #
91
97
  # @return [void]
92
98
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Young