| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
An alternative approach would be using a single string inside an array
and appending to that. This approach is more backwards compatible,
but results in more memory usage.
Fixes #1957
|
| |
|
| |
|
|
|
|
|
|
| |
Many editors clean up trailing white space on save. By removing it all
in one go, it helps keep future diffs cleaner and eases new
contributions by avoiding spurious white space changes on unrelated
lines.
|
| |
|
|
|
|
|
|
|
| |
Coverage after this commit:
3305 relevant lines, 3266 lines covered and 39 lines missed. ( 98.82% )
1133 total branches, 1039 branches covered and 94 branches missed. ( 91.7% )
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds two new predicate methods to the `Rack::Response`
class:
- `not_acceptable?` which returns true on HTTP 406 Not Acceptable
- `request_timeout?` which returns true on HTTP 408 Request Timeout
Links to MDN documentation for each status code:
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
* Allow headers to be an Array of String instances.
* Add deprecated compatibility shims.
|
|
|
|
|
|
| |
Also, update CHANGELOG with other spec changes made since 2.2.
Implements #1592
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add test:separate task to test run each test file separately.
This is to test that directly requiring a rack component will work.
With test:separate, the test helper will not require rack, and each
test file should call separate_testing with a block that uses
require_relative to only require that component being tested.
Add the appropriate relative requires to get all tests passing
when run separately.
Note that this isn't foolproof. In many cases, the tests use
Rack components that are not under test (such as lint and mock),
and both of those other other rack components, so it's possible
the tests are loading hidden dependencies. I attempted to check
each component to try to find the hidden dependencies, but it is
certainly possible I missed something.
Implements #1621.
|
| |
|
| |
|
|
|
|
| |
3378 / 3378 LOC (100.0%) covered
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before, @length was always set to 0 in the constructor. The breaks
the case where a string was provided, since that is automatically
bufferred. Fix that by using the bytesize of the string.
If body was provided as an array, when switching to buffered mode,
iterate over the body to figure out the content length.
Note this only occurs when doing Response#write, as that is the
only case where Response updates the Content-Length.
I found one spec that called Response#write inside a Response#finish
block. That updates the response body after the header hash is
returned, and does not call Response#append as the @writer has been
changed to the Response#finish block, so it doesn't update the
Content-Length in the returned header hash.
|
|
|
|
|
|
| |
For some reason, the test helper was only used by a single spec file.
This uses it for all spec files. While here, rely on autoload
loading the libraries instead of loading everything manually.
|
|
|
|
|
|
|
| |
Also, correctly handle deleting with both a domain and path
provided.
Fixes #1234
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The implementation of `Rack::Response` will double buffer every body even
if the user does not call `#write`. This is inefficient and additionally
imposes some type checking overhead even if none is wanted.
Fixes <https://github.com/socketry/falcon/issues/93>.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Responses are not arrays, so we should not allow them to be implicitly
coerced to an array. If you would like you response to be converted to
an array, you must explicitly do it with the `to_a` method.
This also prevents creation of unnecessary body proxies
|
|
|
|
| |
Global expectations have been deprecated in minitest and will start fail in the upcoming major release. Right now it results in multiple warnings. We need to allow them explicitly. Also fixing spacing style in gemspec.
|
|
|
|
|
| |
- https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#appendix-A.4
- Indicates that cookie is used as a third party cookie.
|
|\
| |
| | |
Performance: remove useless header merge from Response
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
| |
Use Ruby >= 1.9 syntax for hashes
* Required Ruby version is >= 2.2, so It's better to use prefer `{ a: :b }` over `{ :a => :b }` in hash syntax.
* It's hard to modify manufally all points, so I've installed rubocop and enabled only `Style/HashSyntax` (All cops are disabled by default)
* Executed `rubocop --auto-correct`
|
|
|
|
| |
See https://github.com/rack/rack/issues/1243 for history of this task
|
| |
|
|
|
|
| |
Specified in RFC 7231, section 7.1.1.2: Date.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RFC 7231, section 6.3.5 gives three possible options for what a
server MUST do when sending a 205 status code:
> Since the 205 status code implies that no additional content will be
> provided, a server MUST NOT generate a payload in a 205 response. In
> other words, a server MUST do one of the following for a 205
> response: a) indicate a zero-length body for the response by
> including a Content-Length header field with a value of 0; b)
> indicate a zero-length payload for the response by including a
> Transfer-Encoding header field with a value of chunked and a message
> body consisting of a single chunk of zero-length; or, c) close the
> connection immediately after sending the blank line terminating the
> header section.
rack itself has no control over c), but should leave options
a) and b) available for middleware and application authors.
https://tools.ietf.org/html/rfc7231#section-6.3.6
The older RFC 2616 text was vague and not specific about
what a server should do:
https://tools.ietf.org/html/rfc2616#section-10.2.6
I noticed this from Plack: https://metacpan.org/pod/Plack::Util
This reverts commit 2c5b076aaba6c83ffce8c6c2b5c49085c1abb5a5.
|
|
|
|
| |
`must_be_nil` if expecting nil.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The draft spec for the SameSite option mentions two configuration
options: Strict & Lax. This commit introduces validation of the
associated same_site attribute.
The main motivation for validating this value is ensuring that awry
option values don't cause unexpected behaviour. As this is a sensitive
security option, I think validation is warranted.
The main drawback of validating the option value is that Rack won't
immediately support new options.
Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
remove use of `:first_party` option
pass along provided value
make the syntax more flexible
s/strict/Strict/
|
|
|
|
|
|
|
|
| |
Set `first_party: true` to set the First-Party attribute telling
browsers to only send the cookie with legit first-party requests.
* https://tools.ietf.org/html/draft-west-first-party-cookies-00
* https://www.chromestatus.com/feature/4672634709082112
|
|
|
|
| |
Use this for setting cache control headers on your response objects.
|
|
|
|
| |
setting etag values on the response.
|
|
|
|
|
|
|
|
|
|
|
| |
* Introduce `Rack::Response::Helpers#add_header` to add a value to a
multi-valued response header. Implemented in terms of other
`Response#*_header` methods, so it's available to any response-like
class that includes the `Helpers` module.
* Add `Rack::Request#add_header` to match.
* Rename `Response#have_header?` to `#has_header?` to match existing
`Request#has_header?`
* Add test coverage for this and other `*_header` methods.
|
|
|
|
|
|
|
| |
308 status code is ‘Permanent Redirect’ (see
http://greenbytes.de/tech/webdav/draft-reschke-http-status-308-07.html)
and `Rack::Response::Helpers#redirect?` would accept it as a
redirection when 308 status is supported by Rack.
|
|
|
|
|
| |
It was removed in Rack 1.6 from HTTP status codes. See
https://github.com/rack/rack/pull/754
|
|
|
|
|
| |
I still can't run some of the tests, so they might have problems. I'll
leave it to the CI to catch them.
|
| |
|
| |
|