Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Also skip Content-Encoding and Vary header if 304 | Kohei Suzuki | 2015-03-12 | 1 | -3/+4 |
| | |||||
* | 304 response should not include Content-Type header | Kohei Suzuki | 2015-03-10 | 1 | -1/+3 |
| | | | | | Rack::Lint raises an error saying "Content-Type header found in 304 response, not allowed". | ||||
* | Reduce the number of times `#clean_path_info` is called | eileencodes | 2015-02-18 | 1 | -3/+2 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | It's unnecessary to call `#clean_path_info`. It doesn't need to be called on the path with each extension. This reduces allocations to `Rack::Utils` in integration tests. Before `#clean_path_info` from `Rack::Utils` (line 622) was number 2 in top 5 allocations: ``` [["rack/lib/rack/utils.rb", 499, :T_STRING], [51034, 4539, 71559, 0, 12, 1791120]] [["rack/lib/rack/utils.rb", 662, :T_STRING], [33012, 0, 27930, 0, 1, 1226009]] [["rails/activesupport/lib/active_support/notifications/fanout.rb", 55, :T_DATA], [29998, 0, 25380, 0, 1, 3230600]] [["rails/activesupport/lib/active_support/subscriber.rb", 99, :T_STRING], [29996, 0, 25378, 0, 2, 1113840]] [["rails/activesupport/lib/active_support/notifications/instrumenter.rb", 52, :T_HASH], [29994, 147, 27014, 0, 11, 4897784]] ``` After `#clean_path_info` from `Rack::Utils` (line 622) does not appear in the top 5 highest allocations: ``` [["rack/lib/rack/utils.rb", 499, :T_STRING], [47617, 2414, 68969, 0, 12, 1667360]] [["rack/lib/rack/body_proxy.rb", 34, :T_ARRAY], [28230, 0, 26060, 0, 1, 1046800]] [["rails/activesupport/lib/active_support/notifications/fanout.rb", 55, :T_DATA], [28208, 0, 26042, 0, 1, 3034096]] [["rails/activesupport/lib/active_support/subscriber.rb", 99, :T_STRING], [28204, 0, 26040, 0, 1, 1046080]] [["rails/activesupport/lib/active_support/callbacks.rb", 165, :T_DATA], [28200, 0, 26046, 0, 2, 3451800]] ``` | ||||
* | FileHandler should not be called for files outside the root | Aaron Patterson | 2014-10-10 | 1 | -2/+12 |
| | | | | | FileHandler#matches? should return false for files that are outside the "root" path. | ||||
* | Refactor out Dir.glob from ActionDispatch::Static | schneems | 2014-08-27 | 1 | -20/+5 |
| | | | | | | | | Dir.glob can be a security concern. The original use was to provide logic of fallback files. Example a request to `/` should render the file from `/public/index.html`. We can replace the dir glob with the specific logic it represents. The glob {,index,index.html} will look for the current path, then in the directory of the path with index file and then in the directory of the path with index.html. This PR replaces the glob logic by manually checking each potential match. Best case scenario this results in one less file API request, worst case, this has one more file API request. Related to #16464 Update: added a test for when a file of a given name (`public/bar.html` and a directory `public/bar` both exist in the same root directory. Changed logic to accommodate this scenario. | ||||
* | Address comments on Gzip implementation | schneems | 2014-08-24 | 1 | -10/+19 |
| | | | | | | | | | | | | | | | - don't mutate PATH_INFO in env, test - test fallback content type matches Rack::File - change assertion style - make HTTP_ACCEPT_ENCODING comparison case insensitive - return gzip path from method instead of true/false so we don't have to assume later - don't allocate un-needed hash. Original comments: https://github.com/rails/rails/commit/ cfaaacd9763642e91761de54c90669a88d772e5a#commitcomment-7468728 cc @jeremy | ||||
* | Enable gzip compression by default | schneems | 2014-08-20 | 1 | -14/+40 |
| | | | | | | If someone is using ActionDispatch::Static to serve assets and makes it past the `match?` then the file exists on disk and it will be served. This PR adds in logic that checks to see if the file being served is already compressed (via gzip) and on disk, if it is it will be served as long as the client can handle gzip encoding. If not, then a non gzip file will be served. This additional logic slows down an individual asset request but should speed up the consumer experience as compressed files are served and production applications should be delivered with a CDN. This PR allows a CDN to cache a gzip file by setting the `Vary` header appropriately. In net this should speed up a production application that are using Rails as an origin for a CDN. Non-asset request speed is not affected in this PR. | ||||
* | [ci skip] Document ActionDispatch::Static | schneems | 2014-08-05 | 1 | -0/+9 |
| | |||||
* | [ci skip] document ActionDispatch::FileHandler | schneems | 2014-08-05 | 1 | -0/+10 |
| | |||||
* | Fix Encoding::CompatibilityError when public path is UTF-8 | Andrew White | 2013-12-29 | 1 | -3/+3 |
| | | | | | | | | | | | | | | In #5337 we forced the path encoding to ASCII-8BIT to prevent static file handling from blowing up before an application has had chance to deal with possibly invalid urls. However this has a negative side effect of making it an incompatible encoding if the application's public path has UTF-8 characters in it. To work around the problem we check to see if the path has a valid encoding once it has been unescaped. If it is not valid then we can return early since it will not match any file anyway. Fixes #13518 | ||||
* | Fix regression introduced in pull request 8812 | Sam Ruby | 2013-01-11 | 1 | -1/+2 |
| | | | | See https://github.com/rails/rails/pull/8812#commitcomment-2416514 | ||||
* | Eliminate Rack::File headers deprecation warning | Sam Ruby | 2013-01-08 | 1 | -1/+1 |
| | | | | | | | | | | | | See http://intertwingly.net/projects/AWDwR4/checkdepot/section-6.1.html rake test produces: "Rack::File headers parameter replaces cache_control after Rack 1.5." Despite what the message says, it appears that the hearders parameter change will be effective as of Rack 1.5: https://github.com/rack/rack/blob/rack-1.4/lib/rack/file.rb#L24 https://github.com/rack/rack/blob/master/lib/rack/file.rb#L24 | ||||
* | Revert "Invert precedence of content in ActionDispatch::Static" | Andrew White | 2012-12-07 | 1 | -11/+7 |
| | | | | This reverts commit c59734f756b79c39486c45273d2cc5d42cd0c864. | ||||
* | Invert precedence of content in ActionDispatch::Static | Andrew White | 2012-12-06 | 1 | -7/+11 |
| | | | | | | | | | | This commit inverts the precedence in ActionDispatch::Static so that dynamic content will be served before static content. This is so that precompiled assets do not inadvertently get included when running in development mode - it should have no effect in production where static files are usually handled by the web server. Closes #6421 | ||||
* | rename page_cache_extension option to default_static_extension | Francesco Rodriguez | 2012-10-03 | 1 | -1/+1 |
| | |||||
* | fix ArgumentError being raised in case of invalid byte sequences | Michael Reinsch | 2012-03-08 | 1 | -0/+1 |
| | |||||
* | Simplify regexp | Andrew White | 2012-02-17 | 1 | -1/+1 |
| | |||||
* | Fix ActionDispatch::Static to serve files with unencoded PCHAR | Andrew White | 2012-02-17 | 1 | -1/+10 |
| | | | | | | | | | | | RFC 3986[1] allows sub-delim characters in path segments unencoded, however Rack::File requires them to be encoded so we use URI's unescape method to leave them alone and then escape them again. Also since the path gets passed to Dir[] we need to escape any glob characters in the path. [1]: http://www.ietf.org/rfc/rfc3986.txt | ||||
* | escape static file path to prevent double unescaping | Sergey Nartimov | 2012-02-16 | 1 | -1/+1 |
| | |||||
* | cache strings in the AST for faster comparison than include? | Aaron Patterson | 2011-05-03 | 1 | -6/+3 |
| | |||||
* | Static middleware accepts cache control. | José Valim | 2011-05-03 | 1 | -4/+4 |
| | |||||
* | Make static faster as we don't have to serve multiple paths anymore. | José Valim | 2011-04-15 | 1 | -28/+15 |
| | |||||
* | initialize ivars | Aaron Patterson | 2011-03-01 | 1 | -1/+1 |
| | |||||
* | Revert "compute ext in initialize, and use an attr_reader" | Aaron Patterson | 2011-02-28 | 1 | -5/+7 |
| | | | | | | | | This reverts commit 2dbb73bdda3b81947fd112486ac4285fb1a6e3a9. Conflicts: actionpack/lib/action_dispatch/middleware/static.rb | ||||
* | no need to pass a regex to Regexp.compile | Aaron Patterson | 2011-02-28 | 1 | -4/+4 |
| | |||||
* | compute ext in initialize, and use an attr_reader | Aaron Patterson | 2011-02-28 | 1 | -7/+5 |
| | |||||
* | Ensure the proper content type is returned for static files. | José Valim | 2010-10-04 | 1 | -3/+3 |
| | |||||
* | Avoid (@_var ||= nil) pattern by using initialize methods and ensuring ↵ | José Valim | 2010-09-29 | 1 | -2/+1 |
| | | | | everyone calls super as expected. | ||||
* | Initialize @compiled_at if it is not. | Emilio Tagua | 2010-09-28 | 1 | -0/+1 |
| | |||||
* | Do not use ActionController::Base.page_cache_extension in initialize to not ↵ | Piotr Sarnacki | 2010-09-04 | 1 | -4/+8 |
| | | | | load more ActiveSupport than we need | ||||
* | Optimize ActionDispatch::Static | Piotr Sarnacki | 2010-09-04 | 1 | -51/+35 |
| | |||||
* | Modified ActionDispatch::Static to allow passing multiple roots | Piotr Sarnacki | 2010-09-03 | 1 | -10/+50 |
| | |||||
* | Move Rails::Static into ActionDispatch | Joshua Peek | 2009-09-26 | 1 | -0/+44 |