summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Initial conversion and formatting.spec-markdownSamuel Williams2020-02-062-266/+205
|
* Enable `Layout/Tab` to avoid hard tab indentation in the futureRyuta Kamizono2020-02-062-1/+4
| | | | Ref https://github.com/rack/rack/pull/1549#discussion_r375470299, 1f89eaafd39040707bf2a76cab134dd7a78b1441.
* Move from SPEC to SPEC.rdocJeremy Evans2020-02-062-5/+5
| | | | | SPEC is already in rdoc format, and this results in nicer rendering on GitHub.
* Fix indentation.Samuel Williams2020-02-061-2/+2
|
* Refactor and document DeflaterJeremy Evans2020-02-051-30/+43
| | | | | | | | | | | | | 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.
* Call super in method_added hookJeremy Evans2020-02-051-0/+1
|
* Update CHANGELOGJeremy Evans2020-02-051-0/+1
|
* Don't swallow backtrace when reraising query parser errorJeremy Evans2020-02-051-1/+1
|
* Remove `Rack::Files#response_body` as the implementation was broken.Samuel Williams2020-02-053-24/+8
|
* Sort encodings by server preference. Implements #1184.Samuel Williams2020-02-053-8/+16
|
* Prefer instance variables and use explicit returns.Samuel Williams2020-02-051-3/+3
|
* Update CHANGELOG.Samuel Williams2020-02-051-0/+2
|
* avoid errors: undefined method `shutdown' for nil:NilClass (NoMethodError)FUJI Goro2020-02-051-2/+4
| | | when SIGINT is sent multiple times to the webrick handler, the server crashes.
* Convenient cache and content type methods for `Rack::Response`.Samuel Williams2020-02-053-0/+56
|
* Rack::Directory : allow directory trasversal inside root directoryThomas2020-02-052-2/+15
|
* Use `Utils::HeaderHash` to add to existing headers. Fixes #1222.Samuel Williams2020-02-052-1/+9
|
* Handle case where headers are frozen, and add specs.Samuel Williams2020-02-052-1/+30
|
* Update CHANGELOG.Samuel Williams2020-02-051-0/+1
|
* Add brackets around parameters.Samuel Williams2020-02-051-1/+1
| | | Co-Authored-By: Rafael França <rafael@franca.dev>
* Memoize header hash usage. Fixes #738.Samuel Williams2020-02-0511-18/+26
|
* Enable `Style/MethodDefParentheses` cop to avoid newly add no paren method ↵Ryuta Kamizono2020-02-059-41/+44
| | | | | | | | | 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.
* Documentation updatesJeremy Evans2020-02-043-13/+25
|
* Make ConditionalGet follow RFC 7232 precedenceJeremy Evans2020-02-043-14/+30
| | | | | | | | | | 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.
* Refactor and document ChunkedJeremy Evans2020-02-041-20/+47
| | | | | | | | | | | | | | | 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.
* Fix Cascade to use the last response if all responses should be cascadedJeremy Evans2020-02-042-7/+29
| | | | | | | | | 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.
* Allow passing through same_site option to session cookie when using ↵Alex Speller2020-02-043-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 CHANGELOGJeremy Evans2020-02-031-0/+1
|
* Merge pull request #1548 from jeremyevans/sec-policyAaron Patterson2020-02-031-7/+7
|\ | | | | Update security policy
| * Update security policyJeremy Evans2020-02-031-7/+7
|/ | | | | | | 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.
* Support magic comments in .ru filesBenoit Daloze2020-02-033-2/+21
| | | | * Such as # frozen_string_literal: true.
* Add documentation to BodyProxy and BuilderJeremy Evans2020-01-302-6/+82
|
* Update READMEJeremy Evans2020-01-301-10/+54
| | | | | | Briefly mention all middleware that ship with Rack. Mention that you should require rack and not paths under rack.
* Make Cascade use a new response object if initialized with no appsJeremy Evans2020-01-303-4/+23
| | | | | | | | | 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.
* Make BodyProxy correctly delegate keyword arguments on Ruby 2.7+Jeremy Evans2020-01-303-0/+9
|
* Remove BodyProxy#eachJeremy Evans2020-01-303-12/+1
| | | | | | 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.
* Make BackProxy#method handle delegated methodsJeremy Evans2020-01-303-1/+10
| | | | | This doesn't work if you define respond_to?, but does work if you define respond_to_missing?.
* Faster Utils.clean_path_infoschneems2020-01-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Fix `Response` methods (`host`, `port`, etc.) for IPv6Alexander Popov2020-01-302-9/+47
|
* Add a sleep in spec on !CRubyJeremy Evans2020-01-301-0/+1
| | | | JRuby may execute the trap in parallel.
* Use temp path when profiling, may work better in CIJeremy Evans2020-01-301-7/+9
| | | | Also, fix the require in one of the stackprof tests.
* Attempt 2 to satisfy rubocopJeremy Evans2020-01-301-1/+1
|
* Attempt to satisfy rubocopJeremy Evans2020-01-306-12/+12
|
* Add remaining covering testsJeremy Evans2020-01-3016-6/+192
| | | | 3378 / 3378 LOC (100.0%) covered
* Make Lint check response hijackingJeremy Evans2020-01-303-4/+10
| | | | | | | | 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.
* More covering testsJeremy Evans2020-01-307-10/+117
| | | | 3352 / 3378 LOC (99.23%) covered
* Add covering tests for LintJeremy Evans2020-01-301-4/+52
| | | | 3332 / 3380 LOC (98.58%) covered.
* Add covering tests for abstract session supportJeremy Evans2020-01-304-15/+166
| | | | 3316 / 3380 LOC (98.11%) covered
* Add covering tests for Rack::ServerJeremy Evans2020-01-304-3/+241
| | | | | Fixes a bug when in invalid handler is used and -h is also used. That now prints appropriate help. Previously, you got a backtrace.
* Ignore coverage directoryJeremy Evans2020-01-301-0/+1
|
* Skip coverage testing of rack handlersJeremy Evans2020-01-301-0/+1
| | | | | | | Coverage testers may not have the related libraries for these handlers installed. 3219 / 3381 LOC (95.21%) covered.