1
0
mirror of https://github.com/apache/httpd.git synced 2026-01-06 09:01:14 +03:00
Commit Graph

625 Commits

Author SHA1 Message Date
Eric Covener
c9c90fca19 better s-maxage support
+  *) mod_cache: Consider Cache-Control: s-maxage in expiration
+     calculations.  [Eric Covener]
+
+  *) mod_cache: Allow caching of responses with an Expires header
+     in the past that also has Cache-Control: max-age or s-maxage.
+     PR55156. [Eric Covener]




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726675 13f79535-47bb-0310-9956-ffa450edef68
2016-01-25 19:57:33 +00:00
Rainer Jung
44ce30494e Added many log numbers to log statements that
had none.

Handled all files in modules/.

I used the coccinelle script provided by Stefan.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725392 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 00:03:18 +00:00
Yann Ylavic
bcbfbe4ace mod_cache_socache: Fix a possible cached entity body corruption when it
is received from an origin server in multiple batches and forwarded by
mod_proxy.

Upstream buckets should be setaside when saving response body (store_body),
but since those will finally be flatten in the cache buffer (commit_entity),
let's save them directly into the buffer to avoid heap allocation(s) and
the final copy.

Reported by: Mike Pastore <mike oobak.org> 


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1721899 13f79535-47bb-0310-9956-ffa450edef68
2015-12-28 12:09:29 +00:00
Eric Covener
d965bf637f disk_cache: improve logging of errors around reading stored headers
-- add RV and print cache filename from caller.




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1721210 13f79535-47bb-0310-9956-ffa450edef68
2015-12-21 16:38:51 +00:00
Eric Covener
aa543e759a remove dead code leftover from r1023387.
Prior to this revision, there was an apr_atoi64 in this context.
Now, ap_cache_control() sets control.max_age (which is checked here) when
the maxage value was parsed OK.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1718496 13f79535-47bb-0310-9956-ffa450edef68
2015-12-07 23:43:01 +00:00
Eric Covener
78d0543c4e duplicate debug-level AH00764 in the just-validated path.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1718476 13f79535-47bb-0310-9956-ffa450edef68
2015-12-07 21:41:38 +00:00
Yann Ylavic
dcb95434f9 Follow up to r1715876: fix typo.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715938 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 20:05:16 +00:00
Yann Ylavic
ae2e62b5b2 mod_cache: Fix (max-stale with no '=') and enforce (check integers after '=')
Cache-Control header parsing.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715886 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 17:01:19 +00:00
Yann Ylavic
e30575b0b0 More ap_casecmpstr[n]() usages (follow up to r1715876).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715880 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 16:48:35 +00:00
Yann Ylavic
c80e6b2a34 Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715876 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 16:46:01 +00:00
Yann Ylavic
3c9ddf44bf Revert r1715789: will re-commit without spurious functional changes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715869 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 16:28:36 +00:00
Yann Ylavic
29843dc73f Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).
[Reverted by r1715869]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715789 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 12:33:09 +00:00
Christophe Jaillet
f3de5dcfe6 Remove some useless 'return' statements.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715567 13f79535-47bb-0310-9956-ffa450edef68
2015-11-21 20:42:39 +00:00
Christophe Jaillet
46b3048bd6 RFC2616 defines #rules as:
#rule
      A construct "#" is defined, similar to "*", for defining lists of
      elements. The full form is "<n>#<m>element" indicating at least
      <n> and at most <m> elements, each separated by one or more commas
      (",") and OPTIONAL linear white space (LWS). This makes the usual
      form of lists very easy; a rule such as
         ( *LWS element *( *LWS "," *LWS element ))
      can be shown as
         1#element

It also defines Linear White Space (LWS) as:
   LWS            = [CRLF] 1*( SP | HT )


The actual implementation only accepts SP (Space) and not HT (Horizontal Tab) when parsing cache related header fields (i.e. "Vary", "Cache-Control" and "Pragma")

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1710723 13f79535-47bb-0310-9956-ffa450edef68
2015-10-27 06:45:03 +00:00
Yann Ylavic
d6ed470b92 m4: please any autoconf by quoting AC_DEFUN's names. PR 58126.
Submitted by: olli hauer <ohauer gmx.de>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1706918 13f79535-47bb-0310-9956-ffa450edef68
2015-10-05 20:52:51 +00:00
Christophe Jaillet
68131d85a4 Fix some style issues on files that can easily be synch'ed with 2.4.x
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1705983 13f79535-47bb-0310-9956-ffa450edef68
2015-09-30 08:35:35 +00:00
Edward Lu
b2a5a379fc not sure how that got in there
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1704395 13f79535-47bb-0310-9956-ffa450edef68
2015-09-21 19:19:54 +00:00
Edward Lu
938a1c7470 Stop destroying headers when passing through the cache filter
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1704392 13f79535-47bb-0310-9956-ffa450edef68
2015-09-21 19:15:47 +00:00
Christophe Jaillet
6930a7b64d Allow 0 as a valid value (never close idle connections)
Increased maximum allowed value to 3600 s (1 hour)
Use 'ap_timeout_parameter_parse' to allow more flexible configuration (i.e. h, min, s, ms suffixes)
Use 'apr_time_from_sec' when applicable.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1700418 13f79535-47bb-0310-9956-ffa450edef68
2015-09-01 08:23:01 +00:00
Christophe Jaillet
fcae67eba7 Remove useless line
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1700328 13f79535-47bb-0310-9956-ffa450edef68
2015-08-31 20:17:38 +00:00
Christophe Jaillet
8a804d09ba Silence a sparse warning about inconsistent indenting + some minor style issues
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1700326 13f79535-47bb-0310-9956-ffa450edef68
2015-08-31 20:13:30 +00:00
Christophe Jaillet
a369776b21 With the current implementation, it is likely to connect/close a socket with the memcache server for each command sent.
The root cause is a too small idle timeout (600 microseconds).

Add a new directive, 'MemcacheConnTTL',  to control this idle connection timeout with the memcache server(s).
Change the default value from 600 usec (!) to 15 sec as per Yann suggestion.

I've limited accepted values from 1 to 1800 seconds (half an hour) because internaly, the value passed to 'apr_memcache_server_create' is still in mirco-seconds.

PR 58091
~~~~~~~~~~~~~~~~~~~_
Homemade measurement (on a slighly modified version of httpd) shows a +30% in number of processed requests using memcache to cache /index.html.
Comparison made between the 600 usec and 15 sec TTL.

Memcache config:
    default
httpd Config:
    CacheEnable socache /
    CacheSocache memcache:127.0.0.1
    LoadModule mpm_event_module modules/mod_mpm_event.so
httpd compiled with:
    ./configure --enable-mpms-shared=all --with-included-apr --with-mysql --with-libxml2 --enable-modules=reallyall --enable-ssl-ct=no --enable-maintainer-mode --prefix=$HOME/httpd-2.5
httpd and memcache running on the same VM running under Ubuntu 15.04
Load tested using:
    ab -n 20000 http://127.0.0.1/index.html

Creation/closing of connections beetween httpd and memcache confirmed using the telnet connection to memcache and the stats command



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1696105 13f79535-47bb-0310-9956-ffa450edef68
2015-08-15 22:05:08 +00:00
Gregg Lewis Smith
d61f860de7 remove space after \
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1694936 13f79535-47bb-0310-9956-ffa450edef68
2015-08-10 00:09:58 +00:00
Gregg Lewis Smith
e66086d310 Add include path for NetWare build.
Submitted by: normw gknw net.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1694903 13f79535-47bb-0310-9956-ffa450edef68
2015-08-09 20:02:02 +00:00
Rich Bowen
85f20cb5d2 s/the the/the/g
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1690120 13f79535-47bb-0310-9956-ffa450edef68
2015-07-09 16:01:56 +00:00
Gregg Lewis Smith
a8e498ba54 Followup to r1671397 so these will build
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1677096 13f79535-47bb-0310-9956-ffa450edef68
2015-05-01 04:09:02 +00:00
Rainer Jung
0c12000aed Add output for "?auto" version of server-status
to proxy status, mod_ssl session cache info,
mod_cache_socache and the status hook of the
individual socache implementations.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1671397 13f79535-47bb-0310-9956-ffa450edef68
2015-04-05 13:54:22 +00:00
Yann Ylavic
0a431ef862 core, modules: like r1657897 but for core and other modules than mod_proxy.
More uses of ap_map_http_request_error() and AP_FILTER_ERROR so that we never
return an HTTP error status from a handler if some filter generated a response
already.

That is, from a handler, either ap_get_brigade() (an input filter) returned
AP_FILTER_ERROR and we must forward it to ap_die(), or ap_pass_brigade() (an
output filter) failed with any status and we must return AP_FILTER_ERROR in
any case for ap_die() to determine whether a response is needed or not.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1665625 13f79535-47bb-0310-9956-ffa450edef68
2015-03-10 17:25:17 +00:00
Jan Kaluža
53e095830b * mod_cache: Preserve the Content-Type in case of 304 response.
304 does not contain Content-Type and mod_mime regenerates
the Content-Type based on the r->filename. This later leads to original
Content-Type to be lost (overwriten by whatever mod_mime generates).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1665216 13f79535-47bb-0310-9956-ffa450edef68
2015-03-09 12:48:11 +00:00
Joe Orton
750aa727b0 * modules/cache/mod_socache_memcache.c (socache_mc_store): Pass
through expiration time.

Submitted by: Faidon Liambotis <paravoid debian.org>, jorton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1649491 13f79535-47bb-0310-9956-ffa450edef68
2015-01-05 10:06:29 +00:00
Gregg Lewis Smith
7ffd981a56 Added include path for Windows build.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1644245 13f79535-47bb-0310-9956-ffa450edef68
2014-12-09 23:55:22 +00:00
Guenter Knauf
27f17af2a7 Added include path for NetWare build.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1642099 13f79535-47bb-0310-9956-ffa450edef68
2014-11-27 11:30:54 +00:00
Eric Covener
94c4cc461f fix another case of 304 response sent to an unconditional request
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1634237 13f79535-47bb-0310-9956-ffa450edef68
2014-10-25 17:45:30 +00:00
Yann Ylavic
edf45934d4 mod_cache: avoid unlikely access to freed memory.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1632740 13f79535-47bb-0310-9956-ffa450edef68
2014-10-18 08:46:42 +00:00
Rainer Jung
49fd895b9e Silence build warning about missing prototype.
Followup to r1629507.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629652 13f79535-47bb-0310-9956-ffa450edef68
2014-10-06 13:39:30 +00:00
Rainer Jung
41c01c3fd4 mod_cache_socache: Change average object size
hint from 32 bytes to 2048 bytes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629508 13f79535-47bb-0310-9956-ffa450edef68
2014-10-05 17:05:21 +00:00
Rainer Jung
5cbd89b1da mod_cache_socache: Add cache status to server-status.
The status_hook simply calls the status function of
socache, very much like mod_ssl does for the ssl
session cache.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629507 13f79535-47bb-0310-9956-ffa450edef68
2014-10-05 17:00:31 +00:00
Eric Covener
f1c62e52e5 use actual error code in AH00779
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1626416 13f79535-47bb-0310-9956-ffa450edef68
2014-09-20 10:59:30 +00:00
Jan Kaluža
2fa69ec094 SECURITY (CVE-2014-3581): Fix a mod_cache NULL pointer deference
in Content-Type handling.

mod_cache: Avoid a crash when Content-Type has an empty value. PR56924.

Submitted By: Mark Montague <mark catseye.org>
Reviewed By: Jan Kaluza


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1624234 13f79535-47bb-0310-9956-ffa450edef68
2014-09-11 09:18:38 +00:00
Rainer Jung
7dd1f3d0c3 Fix typo in comment.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1620461 13f79535-47bb-0310-9956-ffa450edef68
2014-08-25 21:32:43 +00:00
Eric Covener
31fffa60f9 don't let handlers start with r->status = 304 during a failed revalidation
PR56881



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1619835 13f79535-47bb-0310-9956-ffa450edef68
2014-08-22 15:26:27 +00:00
Christophe Jaillet
3a25c513f3 Add missing APLOGNO.
Refactor to keep APLOGNO on the same line as ap_log_error, when applicable.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1611978 13f79535-47bb-0310-9956-ffa450edef68
2014-07-19 22:02:53 +00:00
Jan Kaluža
66dc61a3f4 mod_cache: try to use the key of a possible open but stale cache entry
if we have one in cache_try_lock(). PR 50317

Submitted by: Ruediger Pluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1597533 13f79535-47bb-0310-9956-ffa450edef68
2014-05-26 09:15:44 +00:00
Rainer Jung
acd15709aa mod_socache_shmcb: Correct counting of expirations for status display.
Expirations happening during retrieval were not counted.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1595426 13f79535-47bb-0310-9956-ffa450edef68
2014-05-17 06:01:35 +00:00
Yann Ylavic
be383e6c93 mod_cache: follow up to r1594643.
Avoid table lookup if not necessary (fast path first).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1594648 13f79535-47bb-0310-9956-ffa450edef68
2014-05-14 17:34:05 +00:00
Yann Ylavic
baf4f92af0 mod_cache: follow up to r1591328.
Define the cache_merge_headers_out() function to merge r->err_headers_out into
r->headers_out and add the ones from r->content_type/encoding if available.
Use it in ap_cache_cacheable_headers_out() where the same is done and in
cache_save_filter() where this has to be done before updating the entry.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1594643 13f79535-47bb-0310-9956-ffa450edef68
2014-05-14 17:11:49 +00:00
Yann Ylavic
308f0615fd mod_cache: follow up to r1591390
Fix code typo.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591394 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 16:53:00 +00:00
Yann Ylavic
f33d682667 mod_cache: follow up to r1591322
Avoid one unnecessary test when checking 304 contradictions.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591390 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 16:34:15 +00:00
Yann Ylavic
4d2d2c5edc mod_cache: Preserve non-cacheable headers forwarded from an origin 304
response. PR 55547.

When mod_cache asks for a revalidation of a stale entry and the origin responds
with a 304 (not that stale), the module strips the non-cacheable headers from
the origin response and merges the stale headers to update the cache.

The problem is that mod_cache won't forward the non-cacheable headers to the
client, for example if the 304 response contains both Set-Cookie and
'Cache-Control: no-cache="Set-Cookie"' headers, or CacheIgnoreHeaders is used.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591328 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 14:58:33 +00:00
Yann Ylavic
0e28401e45 mod_cache: follow up to r1591320.
Use the new MOD_CACHE_ENTITY_HEADERS[] names to check 304 contradictions
against the same headers.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591322 13f79535-47bb-0310-9956-ffa450edef68
2014-04-30 14:53:35 +00:00