aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/cache.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add documentation for #17573Jon Moss2016-02-011-0/+8
| | | | | | Fixes some parts of #23148. [ci skip]
* Response etags to always be weak: Prefixed W/ to value returned by ↵abhishek2016-01-201-1/+1
| | | | ActionDispatch::Http::Cache::Response#etag= such that etags set in fresh_when and stale? are weak. For #17556.
* Commit before freezing the headersMatthew Draper2016-01-121-1/+1
| | | | | This shouldn't generally come up: under a standard flow, we don't start sending until after the commit. But application code always finds a way.
* use methods for accessing the cache control headersAaron Patterson2015-10-061-6/+5
| | | | | Use the methods rack provides so we don't have to worry about the exact header key.
* etag header is in Rack, so use it's response methodsAaron Patterson2015-10-061-6/+2
| | | | | Rack implements the Etag header manipulation methods, so we can use those instead of ours.
* Introduce `Headers#add`. Move `Response#add_header` upstream.Jeremy Daer2015-10-031-2/+2
| | | | | | | * Introduce `ActionDispatch::Http::Headers#add` to add a value to a multivalued header. * Move `Response#add_header` upstream: https://github.com/rack/rack/pull/957 * Match upstream `Response#have_header?` -> `#has_header?` name change.
* Remove not used requiresMarcin Olichwirowicz2015-09-011-1/+0
|
* remove dependency on `@cache_control` ivarAaron Patterson2015-08-271-6/+6
| | | | | eventually we'll remove this instance variable, but this is the first step
* remove `@etag` ivarAaron Patterson2015-08-271-5/+7
| | | | | we're storing the value in the headers hash, so lets just store the value in one place.
* use the abstract API in modulesAaron Patterson2015-08-271-13/+14
| | | | | Modules should be using the API that the abstract modules use so that we can move these modules between implementations
* fewer calls to `env`Aaron Patterson2015-08-241-2/+2
| | | | We don't want to directly access the env hash
* remove `header=` on the response object.Aaron Patterson2015-06-151-4/+4
| | | | | | People should be free to mutate the header object, but not to set a new header object. That header object may be specific to the webserver, and we need to hide it's internals.
* Extract `Date` header to string constant in Http Response, similar to other ↵Vipul A M2015-01-141-3/+4
| | | | headers
* Change Http::Cache::SPECIAL_KEYS from Array to SetMindaugas Mozūras2014-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Slightly improves performance, for example, a simple benchmark: ```ruby require 'benchmark/ips' require 'set' SPECIAL_KEYS = %w[extras no-cache max-age public must-revalidate] SPECIAL_KEYS_SET = Set.new(SPECIAL_KEYS) directive = 'must-revalidate' Benchmark.ips do |x| x.report('array') { SPECIAL_KEYS.include?(directive) } x.report('set') { SPECIAL_KEYS_SET.include?(directive) } end ``` Output: ``` ------------------------------------- array 67926 i/100ms set 74054 i/100ms ------------------------------------- array 2318423.4 (±2.8%) i/s - 11615346 in 5.014899s set 3387981.8 (±4.7%) i/s - 16958366 in 5.019355s ```
* drop an unused hash; change slang to SPECIALVipul A M2013-03-191-2/+2
|
* Check if etag exists before to do the gsubRafael Mendonça França2012-09-151-2/+4
| | | | This fix the build http://travis-ci.org/#!/rails/rails/builds/2459981
* fix the buildSteve Klabnik2012-09-151-0/+1
|
* Support for multiple etags in an If-None-Match headerTravis Warlick2012-09-151-1/+7
| | | | | | | | This is a rebased version of #2520. Conflicts: actionpack/test/dispatch/request_test.rb
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|
* Refactor ActionDispatch::Http::Cache::Response#cache_control_headers.Cainã Costa2012-07-301-11/+19
|
* Ensure that cache-control headers are mergedJames Tucker2012-06-181-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | There are several aspects to this commit, that don't well fit into broken down commits, so they are detailed here: * When a user uses response.headers['Cache-Control'] = some_value, then the documented convention in ConditionalGet is not adhered to, in this case, response.cache_control is ignored due to `return if self[CACHE_CONTROL].present?` * When a middleware sets cache-control headers that would clobber, they're converted to symbols directly, without underscores. This would lead to bugs. * Items that would live in :extras if set through expires_in, are placed directly in the @cache_control hash, and not respected in many cases (somewhat adhering to the aforementioned documentation). * Although quite useless, any directive named 'extras' would be ignored. The general convention applied is that expires_* take precedence, but no longer overwrite everything and expires_* are ALWAYS applied, even if the header is set. I am still unhappy about the contents of this commit, and the code in general. Ideally it should be refactored to no longer use :extras. I'd likely recommend expanding @cache_control into a class, and giving it the power to handle the merge in a more efficient fashion. Such a commit would be a larger change that could have additional semantic changes for other libraries unless they utilize expires_in in very standard ways.
* Merge pull request #3479 from arvida/ensure-date-header-on-expires-inJosé Valim2012-02-181-0/+14
|\ | | | | Ensure Date header on expires_in
| * Added accessor methods for Date headerarvida2011-10-311-0/+14
| |
* | Use freezed string constant. Some string literals is used repeatedly.kennyj2011-12-081-15/+27
|/
* Fix previous commit by allowing a proc to be given as response_body. This is ↵José Valim2011-05-101-14/+12
| | | | deprecated and is going to be removed in future releases.
* removing more unused variablesAaron Patterson2011-01-171-1/+1
|
* Change def to attr_reader + aliasKrekoten' Marjan2010-10-181-10/+3
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Move ETag and ConditionalGet logic from AD::Response to the middleware stack.José Valim2010-10-031-21/+1
|
* no need to assign if we are gonna returnXavier Noria2010-08-121-2/+2
|
* ETag: use body instead of @body since the method will always return a stringJeremy Kemper2010-06-281-2/+2
|
* adds missing requires for Object#blank? and Object#present?Xavier Noria2010-03-281-0/+2
|
* Fix a bunch of pending tests by providing an introspection mode for the ↵Carlhuda2010-02-191-3/+18
| | | | Response object that does up-front parsing of the headers to populate things like @etag
* Split ActionDispatch http in smaller chunks.José Valim2010-01-161-0/+123