You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: SPEC.rdoc
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ The remainder of the request URL's "path", designating the virtual "location" of
34
34
35
35
The <tt>PATH_INFO</tt>, if provided, must be a valid request target or an empty string, as defined by {RFC9110}[https://datatracker.ietf.org/doc/html/rfc9110#target.resource].
36
36
* Only <tt>OPTIONS</tt> requests may have <tt>PATH_INFO</tt> set to <tt>*</tt> (asterisk-form).
37
-
* Only <tt>CONNECT</tt> requests may have <tt>PATH_INFO</tt> set to an authority (authority-form). Note that in <tt>HTTP/2+</tt>, the authority-form is not a valid request target.
37
+
* Only <tt>CONNECT</tt> requests may have <tt>PATH_INFO</tt> set to an authority (authority-form). Note that in HTTP/2+, the authority-form is not a valid request target.
38
38
* <tt>CONNECT</tt> and <tt>OPTIONS</tt> requests must not have <tt>PATH_INFO</tt> set to a URI (absolute-form).
39
39
* Otherwise, <tt>PATH_INFO</tt> must start with a <tt>/</tt> and must not include a fragment part starting with <tt>#</tt> (origin-form).
40
40
@@ -88,7 +88,7 @@ The URL scheme, which must be one of <tt>http</tt>, <tt>https</tt>, <tt>ws</tt>
88
88
89
89
==== <tt>rack.protocol</tt>
90
90
91
-
An optional +Array+ of +String+ values, containing the protocols advertised by the client in the <tt>upgrade</tt> header (<tt>HTTP/1</tt>) or the <tt>:protocol</tt> pseudo-header (<tt>HTTP/2+</tt>).
91
+
An optional +Array+ of +String+ values, containing the protocols advertised by the client in the <tt>upgrade</tt> header (HTTP/1) or the <tt>:protocol</tt> pseudo-header (HTTP/2+).
92
92
93
93
==== <tt>rack.session</tt>
94
94
@@ -167,13 +167,13 @@ The error stream must respond to +puts+, +write+ and +flush+:
167
167
168
168
The hijacking interfaces provides a means for an application to take control of the HTTP connection. There are two distinct hijack interfaces: full hijacking where the application takes over the raw connection, and partial hijacking where the application takes over just the response body stream. In both cases, the application is responsible for closing the hijacked stream.
169
169
170
-
Full hijacking only works with <tt>HTTP/1</tt>. Partial hijacking is functionally equivalent to streaming bodies, and is still optionally supported for backwards compatibility with older Rack versions.
170
+
Full hijacking only works with HTTP/1. Partial hijacking is functionally equivalent to streaming bodies, and is still optionally supported for backwards compatibility with older Rack versions.
171
171
172
172
==== Full Hijack
173
173
174
-
Full hijack is used to completely take over an <tt>HTTP/1</tt> connection. It occurs before any headers are written and causes the server to ignore any response generated by the application. It is intended to be used when applications need access to the raw <tt>HTTP/1</tt> connection.
174
+
Full hijack is used to completely take over an HTTP/1 connection. It occurs before any headers are written and causes the server to ignore any response generated by the application. It is intended to be used when applications need access to the raw HTTP/1 connection.
175
175
176
-
If <tt>rack.hijack</tt> is present in +env+, it must respond to +call+ and return an +IO+ object which can be used to read and write to the underlying connection using <tt>HTTP/1</tt> semantics and formatting.
176
+
If <tt>rack.hijack</tt> is present in +env+, it must respond to +call+ and return an +IO+ object which can be used to read and write to the underlying connection using HTTP/1 semantics and formatting.
177
177
178
178
==== Partial Hijack
179
179
@@ -205,9 +205,9 @@ This is an HTTP status. It must be an Integer greater than or equal to 100.
205
205
The headers must be an unfrozen +Hash+. The header keys must be +String+ values. Special headers starting <tt>rack.</tt> are for communicating with the server, and must not be sent back to the client.
206
206
207
207
* The headers must not contain a <tt>"status"</tt> key.
208
-
* Header keys must conform to {RFC7230}[https://tools.ietf.org/html/rfc7230] token specification, i.e. cannot contain non-printable <tt>ASCII</tt>, <tt>DQUOTE</tt> or <tt>(),/:;<=>?@[\]{}</tt>.
209
-
* Header keys must not contain uppercase <tt>ASCII</tt> characters (A-Z).
210
-
* Header values must be either a +String+, or an +Array+ of +String+ values, such that each +String+ must not contain characters with an <tt>ASCII</tt> ordinal below <tt>040</tt> (32).
208
+
* Header keys must conform to {RFC7230}[https://tools.ietf.org/html/rfc7230] token specification, i.e. cannot contain non-printable ASCII, <tt>DQUOTE</tt> or <tt>(),/:;<=>?@[\]{}</tt>.
209
+
* Header keys must not contain uppercase ASCII characters (A-Z).
210
+
* Header values must be either a +String+, or an +Array+ of +String+ values, such that each +String+ must not contain characters with an ASCII ordinal below 040 (32).
211
211
212
212
==== The <tt>content-type</tt> Header
213
213
@@ -221,7 +221,7 @@ There must not be a <tt>content-length</tt> header key when the status is <tt>1x
221
221
222
222
If the <tt>rack.protocol</tt> header is present, it must be a +String+, and must be one of the values from the <tt>rack.protocol</tt> array from the environment.
223
223
224
-
Setting this value informs the server that it should perform a connection upgrade. In <tt>HTTP/1</tt>, this is done using the +upgrade+ header. In <tt>HTTP/2</tt>, this is done by accepting the request.
224
+
Setting this value informs the server that it should perform a connection upgrade. In HTTP/1, this is done using the +upgrade+ header. In HTTP/2+, this is done by accepting the request.
225
225
226
226
=== The Body
227
227
@@ -239,17 +239,17 @@ If the Body responds to +to_path+, it must return either +nil+ or a +String+. If
239
239
240
240
==== Enumerable Body
241
241
242
-
The Enumerable Body must respond to +each+, which must not be called more than once, and must not be called after being closed. The +each+ method must only yield +String+ values.
242
+
The Enumerable Body must respond to +each+. which must only be called once, must not be called after being closed, and must only yield +String+ values.
243
243
244
244
Middleware must not call +each+ directly on the Body. Instead, middleware can return a new Body that calls +each+ on the original Body, yielding at least once per iteration.
245
245
246
246
If the Body responds to +to_ary+, it must return an +Array+ whose contents are identical to that produced by calling +each+. Middleware may call +to_ary+ directly on the Body and return a new Body in its place. In other words, middleware can only process the Body directly if it responds to +to_ary+. If the Body responds to both +to_ary+ and +close+, its implementation of +to_ary+ must call +close+.
247
247
248
248
==== Streaming Body
249
249
250
-
The Streaming Body must respond to +call+, which must not be called more than once, and must not be called after being closed. The +call+ method must accept a +stream+ argument.
250
+
The Streaming Body must respond to +call+, which must only be called once, must not be called after being closed, and takes a +stream+ argument.
251
251
252
-
The +stream+ argument must respond to: +read+, +write+, <tt><<</tt>, +flush+, +close+, +close_read+, +close_write+, and +closed?+. The semantics of these +IO+ methods must be a best effort match to those of a normal Ruby +IO+ or +Socket+ object, using standard arguments and raising standard exceptions. Servers may simply pass on real +IO+ objects to the Streaming Body. In some cases (e.g. when using <tt>transfer-encoding</tt> or <tt>HTTP/2+</tt>), the server may need to provide a wrapper that implements the required methods, in order to provide the correct semantics.
252
+
The +stream+ argument must respond to: +read+, +write+, <tt><<</tt>, +flush+, +close+, +close_read+, +close_write+, and +closed?+. The semantics of these +IO+ methods must be a best effort match to those of a normal Ruby +IO+ or +Socket+ object, using standard arguments and raising standard exceptions. Servers may simply pass on real +IO+ objects to the Streaming Body. In some cases (e.g. when using <tt>transfer-encoding</tt> or HTTP/2+), the server may need to provide a wrapper that implements the required methods, in order to provide the correct semantics.
Copy file name to clipboardExpand all lines: lib/rack/lint.rb
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -213,7 +213,7 @@ def check_environment(env)
213
213
raiseLintError,"Only OPTIONS requests may have PATH_INFO set to '*' (asterisk-form)"
214
214
end
215
215
whenREQUEST_PATH_AUTHORITY_FORM
216
-
## * Only <tt>CONNECT</tt> requests may have <tt>PATH_INFO</tt> set to an authority (authority-form). Note that in <tt>HTTP/2+</tt>, the authority-form is not a valid request target.
216
+
## * Only <tt>CONNECT</tt> requests may have <tt>PATH_INFO</tt> set to an authority (authority-form). Note that in HTTP/2+, the authority-form is not a valid request target.
217
217
unlessenv[REQUEST_METHOD] == CONNECT
218
218
raiseLintError,"Only CONNECT requests may have PATH_INFO set to an authority (authority-form)"
219
219
end
@@ -325,7 +325,7 @@ def check_environment(env)
325
325
##
326
326
## ==== <tt>rack.protocol</tt>
327
327
##
328
-
## An optional +Array+ of +String+ values, containing the protocols advertised by the client in the <tt>upgrade</tt> header (<tt>HTTP/1</tt>) or the <tt>:protocol</tt> pseudo-header (<tt>HTTP/2+</tt>).
328
+
## An optional +Array+ of +String+ values, containing the protocols advertised by the client in the <tt>upgrade</tt> header (HTTP/1) or the <tt>:protocol</tt> pseudo-header (HTTP/2+).
raiseLintError,"rack.protocol must be an Array of Strings"
@@ -610,11 +610,11 @@ def close(*args)
610
610
##
611
611
## The hijacking interfaces provides a means for an application to take control of the HTTP connection. There are two distinct hijack interfaces: full hijacking where the application takes over the raw connection, and partial hijacking where the application takes over just the response body stream. In both cases, the application is responsible for closing the hijacked stream.
612
612
##
613
-
## Full hijacking only works with <tt>HTTP/1</tt>. Partial hijacking is functionally equivalent to streaming bodies, and is still optionally supported for backwards compatibility with older Rack versions.
613
+
## Full hijacking only works with HTTP/1. Partial hijacking is functionally equivalent to streaming bodies, and is still optionally supported for backwards compatibility with older Rack versions.
614
614
##
615
615
## ==== Full Hijack
616
616
##
617
-
## Full hijack is used to completely take over an <tt>HTTP/1</tt> connection. It occurs before any headers are written and causes the server to ignore any response generated by the application. It is intended to be used when applications need access to the raw <tt>HTTP/1</tt> connection.
617
+
## Full hijack is used to completely take over an HTTP/1 connection. It occurs before any headers are written and causes the server to ignore any response generated by the application. It is intended to be used when applications need access to the raw HTTP/1 connection.
618
618
##
619
619
defcheck_hijack(env)
620
620
## If <tt>rack.hijack</tt> is present in +env+, it must respond to +call+ \
@@ -624,7 +624,7 @@ def check_hijack(env)
624
624
env[RACK_HIJACK]=procdo
625
625
io=original_hijack.call
626
626
627
-
## and return an +IO+ object which can be used to read and write to the underlying connection using <tt>HTTP/1</tt> semantics and formatting.
627
+
## and return an +IO+ object which can be used to read and write to the underlying connection using HTTP/1 semantics and formatting.
628
628
raiseLintError,"rack.hijack must return an IO instance"unlessio.is_a?(IO)
629
629
630
630
io
@@ -724,9 +724,9 @@ def check_headers(headers)
724
724
##
725
725
## * The headers must not contain a <tt>"status"</tt> key.
726
726
raiseLintError,"headers must not contain status"ifkey == "status"
727
-
## * Header keys must conform to {RFC7230}[https://tools.ietf.org/html/rfc7230] token specification, i.e. cannot contain non-printable <tt>ASCII</tt>, <tt>DQUOTE</tt> or <tt>(),/:;<=>?@[\]{}</tt>.
727
+
## * Header keys must conform to {RFC7230}[https://tools.ietf.org/html/rfc7230] token specification, i.e. cannot contain non-printable ASCII, <tt>DQUOTE</tt> or <tt>(),/:;<=>?@[\]{}</tt>.
## Setting this value informs the server that it should perform a connection upgrade. In <tt>HTTP/1</tt>, this is done using the +upgrade+ header. In <tt>HTTP/2</tt>, this is done by accepting the request.
811
+
## Setting this value informs the server that it should perform a connection upgrade. In HTTP/1, this is done using the +upgrade+ header. In HTTP/2+, this is done by accepting the request.
812
812
##
813
813
## === The Body
814
814
##
@@ -854,10 +854,10 @@ def each
854
854
## The Enumerable Body must respond to +each+. \
855
855
raiseLintError,"Enumerable Body must respond to each"unless@body.respond_to?(:each)
856
856
857
-
## It must only be consumed once (calling this method consumes the body). \
857
+
## which must only be called once, \
858
858
raiseLintError,"Response body must only be consumed once (#{@consumed})"unless@consumed.nil?
859
859
860
-
## It must not be called after being closed, \
860
+
## must not be called after being closed, \
861
861
raiseLintError,"Response body is already closed"if@closed
862
862
863
863
@consumed=:each
@@ -917,18 +917,18 @@ def to_ary
917
917
## ==== Streaming Body
918
918
##
919
919
defcall(stream)
920
-
## The Streaming Body must respond to +call+. \
920
+
## The Streaming Body must respond to +call+, \
921
921
raiseLintError,"Streaming Body must respond to call"unless@body.respond_to?(:call)
922
922
923
-
## It must only be consumed once (calling this method consumes the body). \
923
+
## which must only be called once, \
924
924
raiseLintError,"Response body must only be consumed once (#{@consumed})"unless@consumed.nil?
925
925
926
-
## It must not be called after being closed. \
926
+
## must not be called after being closed, \
927
927
raiseLintError,"Response body is already closed"if@closed
928
928
929
929
@consumed=:call
930
930
931
-
## It takes a +stream+ argument.
931
+
## and takes a +stream+ argument.
932
932
##
933
933
## The +stream+ argument must respond to: +read+, +write+, <tt><<</tt>, +flush+, +close+, +close_read+, +close_write+, and +closed?+. \
934
934
@body.call(StreamWrapper.new(stream))
@@ -937,7 +937,7 @@ def call(stream)
937
937
classStreamWrapper
938
938
extendForwardable
939
939
940
-
## The semantics of these +IO+ methods must be a best effort match to those of a normal Ruby +IO+ or +Socket+ object, using standard arguments and raising standard exceptions. Servers may simply pass on real +IO+ objects to the Streaming Body. In some cases (e.g. when using <tt>transfer-encoding</tt> or <tt>HTTP/2+</tt>), the server may need to provide a wrapper that implements the required methods, in order to provide the correct semantics.
940
+
## The semantics of these +IO+ methods must be a best effort match to those of a normal Ruby +IO+ or +Socket+ object, using standard arguments and raising standard exceptions. Servers may simply pass on real +IO+ objects to the Streaming Body. In some cases (e.g. when using <tt>transfer-encoding</tt> or HTTP/2+), the server may need to provide a wrapper that implements the required methods, in order to provide the correct semantics.
0 commit comments