summary refs log tree commit
DateCommit message (Collapse)
2014-11-07Merge pull request #754 from tonyta/http-status-codes-update
Update HTTP Status Codes
2014-11-06update HTTP status codes to IETF RFC 7231
IANA Source: https://www.iana.org/assignments/http-status-codes IETF RFC 7231: https://tools.ietf.org/html/rfc7231
2014-11-06Ensure body is closed inside the proc. Follow existing monkey patch style.
* Serving the rack body is wrapped in begin/ensure/end so that body.close is guaranteed to be called per rack SPEC. When body iteration happens inside a proc, the proc has to have its own begin/ensure/end block to be able to make the same guarantee. * Made my monkey patch for WEBrick::HTTPResponse follow same style as the other monkey patch already present in the file and added a comment.
2014-11-04Revert "Ensure body is closed inside the proc just as it would be outside ↵
the proc" This reverts commit a0b8fe36d456b2dd339d65836a753ff4260dd8f6.
2014-11-04Ensure body is closed inside the proc just as it would be outside the proc
Serving the body is wrapped in begin/ensure/end so that body.close is always called if there are any problems. Now that looping over the body happens in a proc, the proc has to have its own begin/ensure/end block to guarantee the same behavior.
2014-11-03Avoid WEBrick handler buffering the entire response in RAM
2014-10-10Merge pull request #744 from createdbypete/fix-typo
Fix typo in comment
2014-10-10Fix typo in comment
2014-10-05conditionalget: avoid const lookup in case/when HEAD when-lit master
case/when dispatches already optimize away allocation of constant string literals in all C Ruby 1.9.x/2.x releases (ref: opt_case_dispatch in Ruby insns.def) Other Ruby implementations presumably have similar optimizations to encourage prettier code. The following code snippet does not cause GC.count to increase during the two loops, regardless of what `nr' is. Tested on Ruby 1.9.3, 2.1.3, and trunk r47786: GET = "GET" HEAD = "HEAD" REQUEST_METHOD = "REQUEST_METHOD" # unnecessary in 2.2.0+ env = { REQUEST_METHOD => "GET" } nr = 10000000 nr.times do |i| case env[REQUEST_METHOD] when GET, HEAD :foo else :bar end end a = GC.count nr.times do |i| case env[REQUEST_METHOD] when "GET", "HEAD" :foo else :bar end end b = GC.count p [ a, b ]
2014-10-02Merge pull request #739 from schneems/schneems/fix-respond_to
Fix: `respond_to?` takes 2 arguments
2014-10-02Fix: `respond_to?` takes 2 arguments
The `respond_to?` method was optimized for less object creation, unfortunately I also mangled the method signature. This commit reverts the changes introduced in #737 to `BodyProxy#respond_to?` and adds tests. See: https://github.com/rack/rack/pull/737/files#r18359323 cc/ @raggi
2014-10-02Merge pull request #737 from schneems/schneems/less-objects
Less allocated objects on each request
2014-10-02Less allocated objects on each request
How many? Using `memory_profiler` and a Rails app (codetriage.com), master uses: ``` rack/lib x 7318 ``` After this patch, the app uses: ``` rack/lib x 4598 ``` Or `(7318 - 4598) / 7318.0 * 100 # => 37.16` % fewer objects __PER REQUEST__. To do this, I extracted really commonly used strings into top level Rack constants. It makes for a bit of a big diff, but I believe the changes are worth it. Running benchmark/ips against the same app, I'm seeing a performance host of `2~4%` across the entire app response. This doesn't just make Rack faster, it will make your app faster. While we could certainly go overboard and pre-define ALL strings as constants, that would be pretty gnarly to work with. This patch goes after the largest of the low hanging fruit.
2014-09-06Merge pull request #730 from sodabrew/patch-1
Trivial change to use single quotes for consistency
2014-09-03Trivial change to use single quotes for consistency
2014-09-01Merge pull request #729 from jeremy/fixes/default-middleware-override-regression
Restore Rack::Server#middleware backward compatibility
2014-09-01Restore Rack::Server#middleware backward compatibility
Fixes regression in #706. It intends to retain backward compatibility with calls to #middleware by aliasing the method to the new default_middleware_for_environment, but since it doesn't call #middleware internally, subclasses that overrode it no longer work. Restored compatibility by calling #middleware internally and delegating its implementation to the new default_middleware_for_environment methods.
2014-08-22Merge pull request #725 from olistik/features/tempfile-extension
Preserves extension in the created tempfile
2014-08-22Preserves extension in the created tempfile
This is handy when you have to pass the generated tempfile to gems that relies on the detection of filename extension ([simple-spreadsheet](https://github.com/zenkay/simple-spreadsheet), [roo](https://github.com/Empact/roo) to name my use case).
2014-08-18Bump version 1.6.0.beta
2014-08-04Revert "Merge branch 'pr/686'"
This reverts commit e4fd87fc24a6bc10598afb83d5f572db96c241c2, reversing changes made to d8e34e9dc9b78ca5fdb2271ef65cac8fd1c4496d.
2014-08-03And rvm has p328, magical versions!
2014-08-03Apparently 1.9.2-p326 regressed, so fix that
2014-08-03Merge pull request #669 from alindeman/multiple_x_http_forwarded_proto
request.port supports multiple x-http-forwarded-proto values
2014-08-03Merge pull request #674 from ujifgc/be-quiet
add quiet mode of rack server, rackup --quiet
2014-08-03Merge branch 'pr/686'
* pr/686: add support for application/json content type requests
2014-08-03Merge branch 'master' into pr/686
* master: (62 commits) build_nested_query includes integer values Rack::ETag correctly marks etags as Weak Fix yet another body close bug in Rack::Deflater Implement full Logger interface on NullLogger Revert "support empty string multipart filename" support empty string multipart filename multipart/form-data with files with no input name Fix parent type API regression introduced in #713 correct weird case regression from #714 UrlMap: Enable case-insensitive domain matching Raise specific exception if the parameters are invalid Fix media_type_params when Content-Type parameters contains quoted-strings Rack::Multipart::UploadedFile has file extensions multipart content-type match now case insensitive Undo test that falsely exemplifies production env default_middleware_by_environment should always returns empty array for unknown keys Remove rbx from Travis' allow_failures Fix rbx settings for Travis Use latest 2.1 on Travis Enable cleanup of Tempfiles from multipart form data by default ... Conflicts: lib/rack/request.rb
2014-08-03Merge pull request #697 from MichalBryxi/max_age
max-age settings forces Set-Cookie parameter
2014-08-03Merge branch 'spastorino'
* spastorino: build_nested_query includes integer values Conflicts: lib/rack/utils.rb
2014-08-03build_nested_query includes integer values
Patch from @spastorino Closes #557
2014-08-03Merge pull request #698 from IvanUkhov/build-query-empty-arrays
Utils.build_nested_query to handle empty arrays and hashes
2014-08-03Merge pull request #717 from franciscoj/full-logger-interface
Implement full Logger interface on NullLogger
2014-08-03Merge pull request #457 from jakubpawlowicz/master
Configuration options for Rack::Deflate
2014-08-03Rack::ETag correctly marks etags as Weak
Closes #681.
2014-08-03Fix yet another body close bug in Rack::Deflater
2014-08-01Implement full Logger interface on NullLogger
NullLogger implements only a small subset of the Logger public interface. In case you need to hack with your loggers a bit more than usual the NullLogger is useless since it will raise NoMethodError all the time.
2014-07-19Revert "support empty string multipart filename"
This reverts commit 9269d22c56762076e3b775ea65ec1d40494d2402.
2014-07-19add quiet mode of rack server, rackup --quiet
2014-07-18support empty string multipart filename
Closes #702. Enables support for IE11.
2014-07-18multipart/form-data with files with no input name
Closes #695. This is not technically specification correct, but it is included for compatibility with bad clients.
2014-07-18Fix parent type API regression introduced in #713
2014-07-18correct weird case regression from #714
2014-07-18UrlMap: Enable case-insensitive domain matching
Closes #668. Supersedes #668, because it dropped port matching.
2014-07-18Merge pull request #714 from rafaelfranca/rm-fix-media-type-params
Fix media_type_params when Content-Type parameters contains quoted-strings
2014-07-18Merge pull request #713 from rafaelfranca/raise-on-invalid-charset
Raise specific exception if the parameters are invalid
2014-07-18Raise specific exception if the parameters are invalid
There are some cases where we try to parse the parameters but it fails with ArgumentError. 1. When the parameters come from the query string and contains invalid UTF-8 characters. In this case we raise ArgumentError when trying to match the key portion of parameters with a regexp. 2. When the parameters come from the request body and the query string contains invalid % encoded string. In this case we raise ArgumentError when calling URI.decode_www_form_component. Now both cases raise a InvalidParameterError what inherit from TypeError and we can catch this exception to show a bad request for users instead of an internal server error.
2014-07-18Fix media_type_params when Content-Type parameters contains quoted-strings
According RFC 2616, the Content-Type parameters value can be even a token or a quoted-string: media-type = type "/" subtype *( ";" parameter ) type = token subtype = token parameter = attribute "=" value attribute = token value = token | quoted-string quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) qdtext = <any TEXT except <">>" quoted-pair = "\" CHAR
2014-07-18Rack::Multipart::UploadedFile has file extensions
Tempfiles created for file uploads now have file extensions. This enables certain use cases for users that are using file extensions as heuristics. Closes #690
2014-07-18multipart content-type match now case insensitive
Closes #676 This may not be 100% to spec, but it is important for compatibility and should not cause regressions.
2014-07-18Merge pull request #710 from rack/webrick-chunking
Monkey patch to fix WEBrick chunking semantics.