| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Ref https://github.com/rack/rack/pull/1549#discussion_r375470299, 1f89eaafd39040707bf2a76cab134dd7a78b1441.
|
|
|
|
|
| |
SPEC is already in rdoc format, and this results in nicer rendering
on GitHub.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Explicit :sync => nil option is now treated as false instead of true.
We documented the default was true, but any explicit :sync option
should be respected.
gzip.write returns the length of the input string, so simplify the
GzipStream#each implementation by skipping all empty body strings.
Don't set @writer and @body to nil in GzipStream after using them.
We don't use this pattern in BodyProxy, so I don't see a need to
use it here.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
when SIGINT is sent multiple times to the webrick handler, the server crashes.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
Co-Authored-By: Rafael França <rafael@franca.dev>
|
| |
|
|
|
|
|
|
|
|
|
| |
def in the future
Ref https://github.com/rack/rack/pull/1549#discussion_r374383058.
If we'd not prefer the no paren method def style and avoid the style by
code review, we have a way to avoid that style by using RuboCop.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
RFC 7232 specifies that if both If-None-Match and If-Modified-Since
are present, then If-Modified-Since should be ignored. The
previous behavior considered both if both were provided (it
predated RFC 7232).
While here, refactor and add documentation. Remove some checks
from private methods where the caller performs the same check.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The most important part of the documentation is how to use the
Trailer header correctly. It was not obvious before that the
response body is expected to have a trailers method already
defined.
Body doesn't need to include Rack::Utils. This was originally done
for the bytesize method, which is no longer used.
Rename insert_trailers to yield_trailers to reflect what the method
does.
Other minor refactorings for better performance and simpler code.
|
|
|
|
|
|
|
|
|
| |
This was broken in the last commit for Cascade. The behavior
wasn't specified, but it previously returned the response from
the final app, and that is a better idea than the default 404
response.
Also add documentation for Cascade.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rack::Session::Cookie middleware
Recently, rack added support for SameSite=None cookies: https://github.com/rack/rack/pull/1358
However there is currently no way to set these cookies using the Rack::Session::Cookie
middleware without monkeypatching.
This pull request allows setting the SameSite value either by direct, literal
passthrough to the add_cookie_to_header method, or by passing a callable.
The callable option is required because some browsers are incompatible with
some values of the header, so it needs to be [different per-browser](https://www.chromium.org/updates/same-site/incompatible-clients).
Static usage:
```ruby
use Rack::Session::Cookie, secret: 'supersecret', same_site: :none
```
Dynamic usage:
```ruby
use Rack::Session::Cookie,
secret: 'supersecret',
same_site: lambda { |req, res| SameSite.value(req.user_agent) }
```
|
| |
|
|\
| |
| | |
Update security policy
|
|/
|
|
|
|
|
| |
Remove entry about providing backports to unsupported versions in git,
as that is a contridiction (providing backports is providing at least
minimal support). Of course, nothing precludes us from doing this,
but we don't want users to consider it an expectation.
|
|
|
|
| |
* Such as # frozen_string_literal: true.
|
| |
|
|
|
|
|
|
| |
Briefly mention all middleware that ship with Rack.
Mention that you should require rack and not paths under rack.
|
|
|
|
|
|
|
|
|
| |
The previous behavior was broken if a middleware modified any
part of the response.
Modify the logic slightly to use an early return instead of just
breaking out of the loop, which should be faster in the general
case.
|
| |
|
|
|
|
|
|
| |
This was added due to issue #434, but the links in that issue
make clear it is only needed in Ruby <1.9.3. As Ruby 2.3+ is
now required, this should be safe to remove.
|
|
|
|
|
| |
This doesn't work if you define respond_to?, but does work if
you define respond_to_missing?.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The purpose of the `File.join` is to deal with redundant slashes for example
```
File.join("foo/", "bar")
# => "foo/bar"
```
In this case we are guaranteed that there will be not slashes in our data because we are first splitting by separators:
```
parts = path_info.split PATH_SEPS
```
We can speed up this call then by using the `Array#join` method which does less work:
```
require 'benchmark/ips'
SOURCE_ARRAY = ["foo", "bar"]
Benchmark.ips do |x|
x.report("Array#join") do |times|
i = 0
while i < times
SOURCE_ARRAY.join(::File::SEPARATOR)
i +=1
end
end
x.report("File#join") do |times|
i = 0
while i < times
::File.join(SOURCE_ARRAY)
i +=1
end
end
x.compare!
end
```
You can see this method of building strings is roughly 2.55 times faster than the current method
```
Warming up --------------------------------------
Array#join 111.966k i/100ms
File#join 62.000k i/100ms
Calculating -------------------------------------
Array#join 2.075M (±12.1%) i/s - 10.189M in 5.022957s
File#join 813.613k (±11.5%) i/s - 4.030M in 5.052667s
Comparison:
Array#join: 2075017.5 i/s
File#join: 813613.1 i/s - 2.55x slower
```
|
| |
|
|
|
|
| |
JRuby may execute the trap in parallel.
|
|
|
|
| |
Also, fix the require in one of the stackprof tests.
|
| |
|
| |
|
|
|
|
| |
3378 / 3378 LOC (100.0%) covered
|
|
|
|
|
|
|
|
| |
The previous code to do this was broken, since it modified a
local variable and not the actual response headers. Note that
this checking can only be done if the response headers are a
hash, as this requires modifying the response headers, so it
is only done in that case.
|
|
|
|
| |
3352 / 3378 LOC (99.23%) covered
|
|
|
|
| |
3332 / 3380 LOC (98.58%) covered.
|
|
|
|
| |
3316 / 3380 LOC (98.11%) covered
|
|
|
|
|
| |
Fixes a bug when in invalid handler is used and -h is also used.
That now prints appropriate help. Previously, you got a backtrace.
|
| |
|
|
|
|
|
|
|
| |
Coverage testers may not have the related libraries for these
handlers installed.
3219 / 3381 LOC (95.21%) covered.
|