aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey/router.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused `Journey::Router::RoutingError`yuuji.yaginuma2018-11-181-3/+0
| | | | `Journey::Router::RoutingError` is no longer used since db06d128262b49c8b02e153cf95eb46f4eff364b.
* removed unnecessary returnsShuhei Kitagawa2017-10-281-1/+1
|
* [Action Pack] require => require_relativeAkira Matsuda2017-10-211-6/+6
| | | | | This basically reverts e9fca7668b9eba82bcc832cb0061459703368397, d08da958b9ae17d4bbe4c9d7db497ece2450db5f, d1fe1dcf8ab1c0210a37c2a78c1ee52cf199a66d, and 68eaf7b4d5f2bb56d939f71c5ece2d61cf6680a3
* Path parameters should default to UTF8eileencodes2017-08-011-1/+6
| | | | | | | | | | | | | | | | | | | | This commit changes the behavior such the path_params now default to UTF8 just like regular parameters. This also changes the behavior such that if a path parameter contains invalid UTF8 it returns a 400 bad request. Previously the behavior was to encode the path params as binary but that's not the same as query params. So this commit makes path params behave the same as query params. It's important to test with a path that's encoded as binary because that's how paths are encoded from the socket. The test that was altered was changed to make the behavior for bad encoding the same as query params. We want to treat path params the same as query params. The params in the test are invalid UTF8 so they should return a bad request. Fixes #29669 *Eileen M. Uchitelle, Aaron Patterson, & Tsukuru Tanimichi*
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+2
|
* [Action Dispatch] require => require_relativeAkira Matsuda2017-07-011-6/+6
|
* Fully initialize routes before the first request is handledJean Boussier2017-01-181-0/+7
| | | | | | | | | | | | `AD::Journey::GTG::Simulator` is lazily built the first time `Journey::Router#find_routes` is invoked, which happens when the first request is served. On large applications with many routes, building the simulator can take several hundred milliseconds (~700ms for us). Triggering this initialization during the boot process reduces the impact of deploys on the application response time.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-2/+2
|
* Merge pull request #26156 from sfaxon/route_visualizer_fixRafael França2016-08-161-1/+3
|\ | | | | fix Rails.application.routes.router.visualizer for router debugging
| * fix Rails.application.routes.router.visualizer for router debuggingSeth Faxon2016-08-131-1/+3
| | | | | | | | fixes error due to Routes#partitioned_routes being removed
* | Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
|/ | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in actionpack/libXavier Noria2016-08-061-9/+9
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Remove unused Journey codeJon Moss2016-02-171-3/+0
| | | | | | | | | | - `VERSION` shouldn't be there anymore since Journey is technically part of Action Dispatch now (and thus Action Pack, and follows the normal Rails versioning scheme) - `backwards.rb` was only in the file tree because early in the history or Journey (back in 2011!), it was moved from under the Rack namespace, to its own namespace, Journey! This file is no longer required, and is assigning constants that are no longer needed.
* use predicate methods instead of hard coding verb stringsAaron Patterson2015-08-141-1/+1
| | | | | also change the feeler to subclass AD::Request so that it has all the methods that Request has
* remove hard coded regular expressionAaron Patterson2015-08-141-1/+1
|
* remove StrexpAaron Patterson2015-08-131-1/+0
| | | | | This was a useless object. We can just directly construct a Path::Pattern object without a Strexp object.
* Respect routing precedence for HEAD requestsHarry Marr2015-03-201-1/+2
| | | | | | | Fixes the issue described in #18764 - prevents Rack middleware from swallowing up HEAD requests that should have been matched by a higher-precedence `get` route, but still allows Rack middleware to respond to HEAD requests.
* Merge pull request #15806 from tgxworld/partition_routes_during_setupAaron Patterson2015-03-021-1/+1
|\ | | | | Partition routes during setup.
| * Partition routes during setup.Guo Xiang Tan2015-02-261-1/+1
| | | | | | | | | | | | | | Partitioning of all the routes is currently being done during the first request. Since there is no need to clear the cache for `partitioned_routes` when adding a new route. We can move the partitioning of the routes during setup time.
* | Revert "Merge pull request #18764 from tsun1215/master"Jeremy Kemper2015-02-261-1/+0
|/ | | | | This reverts commit b6dd0c4ddebf5e7aab0a669915cb349ec65e5b88, reversing changes made to de9a3748c436f849dd1877851115cd94663c2725.
* Explicitly ignored wildcard verbs from head_routesTerence Sun2015-02-081-0/+1
| | | | | | In match_head_routes, deleted the routes in which request.request_method was empty (matches all HTTP verbs) when responding to a HEAD request. This prevents catch-all routes (such as Racks) from intercepting the HEAD request. Fixes #18698
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-2/+2
|
* Avoid duplicating routes for HEAD requests.Guo Xiang Tan2014-08-211-17/+23
| | | | | | | | Follow up to rails#15321 Instead of duplicating the routes, we will first match the HEAD request to HEAD routes. If no match is found, we will then map the HEAD request to GET routes.
* Replace x.sort_by!.select! with x.select!.sort_by!Viktar Basharymau2014-06-201-1/+2
| | | | | | | | | The latter has the same speed as the former in the worst case and faster in general, because it is always better to sort less items. Unfortunately, `routes.select!{...}.sort_by!{...}` is not possible here because `select!` returns `nil`, so select! and sort! must be done in two steps.
* Fix request's path_info when a rack app mounted at '/'.Larry Lv2014-06-141-0/+1
| | | | Fixes issue #15511.
* Merge branch 'constraints'Aaron Patterson2014-05-271-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * constraints: rm reset_parameters because we automatically do it from 9ca4839a move path_parameter encoding check to the request object dispatcher doesn't need `call` anymore call `serve` with the request on dispatchers constraints class does not need the request class anymore give all endpoints a superclass skip the build business if the stack is empty stop hardcoding path_parameters and get it from the request we do not need to cache rack_app a redirect is not a dispatcher by definition, so eliminate test push is_a check up to where the Constraints object is allocated pass the request object to the application pass a request to `matches?` so we can avoid creating excess requests nothing is passed to `rack_app` anymore, so rm the params one fewer is_a check Constraints#app should never return another Constraints object, so switch to if statement eliminate dispatcher is_a checks push is_a?(Dispatcher) check in to one place Always construct route objects with Constraint objects Conflicts: actionpack/lib/action_controller/metal.rb
| * pass the request object to the applicationAaron Patterson2014-05-251-1/+1
| |
* | Merge pull request #15321 from ↵Santiago Pastorino2014-05-271-1/+4
|\ \ | | | | | | | | | | | | tgxworld/only_find_routes_as_heads_for_head_request Call get_routes_as_head only on HEAD requests.
| * | Call get_routes_as_head only on HEAD requests.Guo Xiang Tan2014-05-251-1/+4
| |/
* / Remove unnecessary flatten! method call.Guo Xiang Tan2014-05-251-3/+1
|/
* there is no formatter on the router object, so rmAaron Patterson2014-05-231-1/+0
|
* decouple the router object from the request classAaron Patterson2014-05-231-5/+3
|
* pass the correct custom request to the recognize methodAaron Patterson2014-05-231-3/+1
|
* switch to the `serve` method so we can remove the request class (eventually)Aaron Patterson2014-05-231-6/+0
|
* extract request allocation from the main app serving routineAaron Patterson2014-05-231-2/+4
|
* use the accessors on the request object rather than touching envAaron Patterson2014-05-231-2/+2
|
* find_routes only use the request, so stop passing envAaron Patterson2014-05-231-3/+3
|
* remove NullRequest and just always pass a request classAaron Patterson2014-05-231-26/+1
|
* use the request object since we have itAaron Patterson2014-05-231-8/+9
| | | | | stop hardcoding hash keys and use the accessors provided on the request object.
* stop using PARAMETERS_KEY, and use the accessor on the request objectAaron Patterson2014-05-221-6/+6
| | | | this decouples our code from the env hash a bit.
* pass the instantiated request to the find_routes methodAaron Patterson2014-05-221-5/+7
|
* drop hash allocations during matchAaron Patterson2014-05-211-2/+2
|
* fewer object allocations and method calls during route matchAaron Patterson2014-05-211-5/+5
|
* middle variable is never used, so rmAaron Patterson2014-05-211-1/+1
|
* do not create memo objects since we'll just throw them awayAaron Patterson2014-04-011-2/+1
|
* Revert "Don't remove trailing slash from PATH_INFO for mounted apps"Piotr Sarnacki2014-01-161-7/+1
| | | | | | | The revert is needed because of a regression described in #13369, routes with trailing slash are no longer recognized properly. This reverts commit 50311f1391ddd8e0349d74eb57f04b7e0045a27d.
* Don't remove trailing slash from PATH_INFO for mounted appsPiotr Sarnacki2013-06-211-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Previously when app was mounted as following: class Foo def call(env) [200, {}, [env['PATH_INFO']]] end end RackMountRailsBug::Application.routes.draw do mount RackTest.new => "/foo" end trailing slash was removed from PATH_INFO. For example requesting GET /foo/bar/ on routes defined above would result in a response containing "/foo/bar" instead of "/foo/bar/". This commit fixes the issue. (closes #3215)
* make [] method in router more readablebuddhamagnet2013-04-151-1/+3
|
* Add support for other types of routing constraintsAndrew White2013-01-151-5/+1
| | | | | | | | | | | | | | This now allows the use of arrays like this: get '/foo/:action', to: 'foo', constraints: { subdomain: %w[www admin] } or constraints where the request method returns an Fixnum like this: get '/foo', to: 'foo#index', constraints: { port: 8080 } Note that this only applies to constraints on the request - path constraints still need to be specified as Regexps as the various constraints are compiled into a single Regexp.