aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware
Commit message (Collapse)AuthorAgeFilesLines
* Add three new rubocop rulesRafael Mendonça França2016-08-165-8/+8
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-063-4/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-069-250/+250
|
* modernizes hash syntax in actionpackXavier Noria2016-08-063-3/+3
|
* applies new string literal convention in actionpack/libXavier Noria2016-08-0619-115/+115
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Don't raise ActionController::UnknownHttpMethod from ActionDispatch::StaticGrey Baker2016-07-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | The `ActionDispatch::Static` middleware is used low down in the stack to serve static assets before doing much processing. Since it's called from so low in the stack, we don't have access to the request ID at this point, and generally won't have any exception handling defined (by default `ShowExceptions` is added to the stack quite a bit higher and relies on logging and request ID). Before https://github.com/rails/rails/commit/8f27d6036a2ddc3cb7a7ad98afa2666ec163c2c3 this middleware would ignore unknown HTTP methods, and an exception about these would be raised higher in the stack. After that commit, however, that exception will be raised here. If we want to keep `ActionDispatch::Static` so low in the stack (I think we do) we should suppress the `ActionController::UnknownHttpMethod` exception here, and instead let it be raised higher up the stack, once we've had a chance to define exception handling behaviour. This PR updates `ActionDispatch::Static` so it passes `Rack::Request` objects to `ActionDispatch::FileHandler`, which won't raise an `ActionController::UnknownHttpMethod` error. If an unknown method is passed, it should exception higher in the stack instead, once we've had a chance to define exception handling behaviour.`
* Handle `Rack::QueryParser` errors in `ActionDispatch::ExceptionWrapper`Grey Baker2016-07-121-2/+2
| | | | | | | | | | | | Rack [recently](https://github.com/rack/rack/commit/7e7a3890449b5cf5b86929c79373506e5f1909fb) moved the namespace of its `ParameterTypeError` and `InvalidParameterError` errors. Whilst an alias for the old name was added, the logic in `ActionDispatch::ExceptionWrapper` was still broken by this change, since it relies on the class name. This PR updates `ActionDispatch::ExceptionWrapper` to handle the Rack 2.0 namespaced errors correctly. We no longer need to worry about the old names, since Rails specifies Rack ~> 2.0.
* Add a test case for verifying `cookie_only` is set even if user tries to set ↵Prathamesh Sonpatki2016-07-071-1/+1
| | | | it false
* [ci skip] Correct defaults in documentation for ActionDispatch::SSLTim Rogers2016-07-061-4/+5
| | | | `config.ssl_options` permits configuring various options for the middleware. Default options for HSTS (specified with the `:hsts` key in the options hash) are specified in `.default_hsts_options`. The documentation did not make clear these defaults, and in one case was wrong.
* Merge pull request #25344 from matthewd/debug-locksMatthew Draper2016-07-021-0/+122
|\ | | | | ActionDispatch::DebugLocks
| * Provide a middleware to debug misbehaving locksMatthew Draper2016-06-101-0/+122
| | | | | | | | | | Only intended to be enabled when in use; by necessity, it sits above any reasonable access control.
* | Silence DebugExceptions template render logs during exceptionsGenadi Samokovarov2016-07-021-0/+8
|/ | | | | | | | | | | | When an exception is raised, those Action View rendering logs are just noise for the end developer. I recently silenced those from Web Console, as we do use Action View rendering in it as well. It used created a half a screen of rendering logs. I think we can save those in this recent push for cleaner development logs. Now, the silencing is a bit hacky and we have a bunch of it now, so we can also invest in turning off the logs directly from Action View objects instead of silencing off the logging stream.
* Merge pull request #24912 from prathamesh-sonpatki/api-fix-response-formatSantiago Pastorino2016-05-111-8/+12
|\ | | | | API only apps: Preserve request format for HTML requests too
| * API only apps: Preserve request format for HTML requests tooPrathamesh Sonpatki2016-05-111-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | - Earlier we were responding with JSON format for HTML requests in a API app. - Now we will respond with HTML format for such requests in API apps. - Also earlier we were not testing the API app's JSON requests properly. We were actually sending HTML requests. Now we send correct JSON requests. Also added more test coverage. - Based on the discussion from this commit - https://github.com/rails/rails/commit/05d89410bf97d0778e78558db3c9fed275f8a614. [Prathamesh Sonpatki, Jorge Bejar]
* | use Rack::Utils.valid_path? to check pathJordan Owens2016-05-091-6/+2
| | | | | | | | This commit uses the new method in Rack to check if a path is valid.
* | Make flash messages cookie compatible with Rails 4Rafael Mendonça França2016-05-061-1/+1
|/ | | | | | | | In #18721 we removed the discard key from the session hash used to flash messages and that broke compatibility with Rails 4 applications because they try to map in the discarded flash messages and it returns nil. Fixes #24726.
* Fix deprecation warning for ParamsParser instance :smile:Prathamesh Sonpatki2016-03-301-1/+1
|
* Deprecate ActionDispatch::ParamsParser instance.Rafael Mendonça França2016-03-301-0/+1
| | | | | | Related with 38d2bf5fd1f3e014f2397898d371c339baa627b1. cc @tenderlove
* Fix request.reset_session for API controllersJon Moss2016-03-191-0/+5
| | | | | | | | | | | | Due to that `ActionDispatch::Flash` (the flash API's middleware) is not included for API controllers, the `request.reset_session` method, which relies on there being a `flash=` method which is in fact defined by the middleware, was previously breaking. Similarly to how add46482a540b33184f3011c5c307f4b8e90c9cc created a method to be overridden by the flash middleware in order to ensure non-breakage, this is how flashes are now reset. Fixes #24222
* [ci skip] Fix constrain_to documentation.Kasper Timm Hansen2016-03-031-1/+1
| | | | | Forgot to update the documentation on the line just above the one I was changing in 4933132. Well done, Kasper :+1:
* Rename constrain_to to exclude.Kasper Timm Hansen2016-03-031-3/+4
| | | | | | | | | `ActionDispatch::SSL` redirects all HTTP requests to HTTPS, not just some. The `constrain_to` option inverts this, so it sounds like the middleware only handles a few requests, rather than the majority with a few routes to opt out of the redirect. Renaming to `exclude` matches this intent more closely.
* Don't reference Rails.application from inside a componentMatthew Draper2016-03-021-10/+6
|
* Publish AS::Executor and AS::Reloader APIsMatthew Draper2016-03-024-78/+47
| | | | | | These should allow external code to run blocks of user code to do "work", at a similar unit size to a web request, without needing to get intimate with ActionDipatch.
* Drop Action Controller require in ActionDispatch::ExceptionWrapperGenadi Samokovarov2016-02-291-1/+0
| | | | | | | | | | | | We only reference the Action Controller error classes by name in ActionDispatch::ExceptionWrapper, so there is no need to explicitly require them. It drops a tiny coupling between Action Dispatch and Action Controller, so it makes me feel warm inside. We still have a lot of others AC requires in the AD code base, but here, we can save it. [ci skip]
* add `constraint_to` option to SSL middlewareGreg Molnar2016-02-281-2/+6
|
* :nail_care:Rafael Mendonça França2016-02-251-2/+2
|
* Update documentation and deprecation messagePrathamesh Sonpatki2016-02-251-3/+3
|
* Added deprecation for older appsPrathamesh Sonpatki2016-02-251-1/+12
| | | | | | | | - For old apps which are not setting any value for hsts[:subdomains], a deprecation warning will be shown saying that hsts[:subdomains] will be turned on by default in Rails 5.1. Currently it will be set to false for backward compatibility. - Adjusted tests to reflect this change.
* HSTS without IncludeSubdomains is often uselessEgor Homakov2016-02-251-1/+1
| | | | | | | | 1) Because if you forget to add Secure; to the session cookie, it will leak to http:// subdomain in some cases 2) Because http:// subdomain can Cookie Bomb/cookie force main domain or be used for phishing. That's why *by default* it must include subdomains as it's much more common scenario. Very few websites *intend* to leave their blog.app.com working over http:// while having everything else encrypted. Yes, many developers forget to add subdomains=true by default, believe me :)
* Transform the mime object to symbol when registering the parsersRafael Mendonça França2016-02-221-0/+1
| | | | | This will keep our current API working without having the users to change their codebases.
* Fix code styleRafael Mendonça França2016-02-171-3/+4
| | | | This change was added in #23203 and it was not conforming our code style.
* Merge pull request #23203 from vipulnsward/22979-show-tags-on-exceptionRichard Schneeman2016-02-161-7/+11
|\ | | | | WIP: Errors in logs should show log tags as well.
| * WIP: Errors in logs should show log tags as well.Vipul A M2016-02-121-7/+11
| | | | | | | | | | | | | | - Changed formatted_code_for to return array of logs to be tagged for each line - Changed some render tests to match new behaviour of return Fixes #22979
* | Join values using '; ' as per RFC specAndrew White2016-02-161-1/+1
| | | | | | | | | | | | | | Multiple cookie values should be separated by '; ' according to RFC 6265, section 5.4.4[1]. [1]: https://tools.ietf.org/html/rfc6265#section-5.4
* | Add require and move escape to private methodAndrew White2016-02-161-1/+6
| |
* | Merge branch 'should-escape-cookie' of https://github.com/ma2gedev/rails ↵Andrew White2016-02-161-1/+1
|\ \ | | | | | | | | | into ma2gedev-should-escape-cookie
| * | Escape cookie's key and value in ActionController::TestCaseTakayuki Matsubara2015-12-301-1/+1
| | | | | | | | | | | | | | | Get an incorrect cookie value in controller action method if cookie value contains an escapable string.
* | | Corrected secret_key_basevs4vijay2016-02-151-1/+1
| |/ |/|
* | Revert "Its ideal to set Vary: Accept-Encoding, irrespective of whether ↵schneems2016-01-191-1/+1
| | | | | | | | | | | | | | | | gzipped version exists or not. This is helpful for CDN's to later distinguish assets, based on previous, current copies and introduced gzip version if any." This reverts commit 067c52f608568e35181830a5c1016e382650e655. Conversation: https://github.com/rails/rails/pull/23120#issuecomment-173007011
* | Its ideal to set Vary: Accept-Encoding, irrespective of whether gzipped ↵Vipul A M2016-01-191-1/+1
| | | | | | | | | | | | | | | | version exists or not. This is helpful for CDN's to later distinguish assets, based on previous, current copies and introduced gzip version if any. For ref: https://www.fastly.com/blog/best-practices-for-using-the-vary-header This change sets `Vary` header always, to be on safer side
* | Prevent attempt to serve a request with a null byteJordan Owens2016-01-121-1/+5
| | | | | | | | | | | | File paths cannot contain null byte characters and methods that do path operations such as Rack::Utils#clean_path_info will raise unwanted errors.
* | Flexible configuration for ActionDispatch::SSLTim Rogers2015-12-291-8/+12
|/
* Improve RDoc documentation of ActionDispatch::SSLTim Rogers2015-12-241-12/+14
|
* Add #== back to ActionDispatch::MiddlewareStack::MiddlewareJon Moss2015-12-211-0/+9
| | | | | This was causing bug #22738 to occur. Also added extra tests to make sure everything is A-OK.
* Refer to rails command instead of rake in a bunch of placesDavid Heinemeier Hansson2015-12-181-1/+1
| | | | Still more to do. Please assist!
* Avoid warning because of the mime typeJorge Bejar2015-12-091-1/+1
|
* DebugException initialize with a response_format valueJorge Bejar2015-12-091-6/+7
|
* Better name for method in DebugExceptions middlewareJorge Bejar2015-12-091-2/+2
|
* Minor cleanup in AD::DebugExceptionsJorge Bejar2015-12-091-6/+9
|
* Remove unneeded args in AD::DebugExceptionsJorge Bejar2015-12-091-1/+0
|