Accepting request 505095 from Apache

-  remove /usr/bin/http2 symlink only during apache2 package
  uninstall, not upgrade [bsc#1041830]

- updated to 2.4.26: This release of Apache is a security, feature, 
  and bug fix release. For details, see
  http://httpd.apache.org/dev/dist/CHANGES_2.4.26
- refreshed patches:
  . httpd-2.4.12-lua-5.2.patch
  . httpd-2.4.x-fate317766-config-control-two-protocol-options.diff
- removed patches (upstreamed)
  . httpd-cache-forward-http-proxy.patch
  . httpd-cache-revert-svn1773397.patch

OBS-URL: https://build.opensuse.org/request/show/505095
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/apache2?expand=0&rev=134
This commit is contained in:
Dominique Leuenberger 2017-06-21 11:52:48 +00:00 committed by Git OBS Bridge
commit 3477d95b0e
10 changed files with 88 additions and 435 deletions

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Tue Jun 20 13:57:18 UTC 2017 - pgajdos@suse.com
- remove /usr/bin/http2 symlink only during apache2 package
uninstall, not upgrade [bsc#1041830]
-------------------------------------------------------------------
Mon Jun 19 08:15:40 UTC 2017 - pgajdos@suse.com
- updated to 2.4.26: This release of Apache is a security, feature,
and bug fix release. For details, see
http://httpd.apache.org/dev/dist/CHANGES_2.4.26
- refreshed patches:
. httpd-2.4.12-lua-5.2.patch
. httpd-2.4.x-fate317766-config-control-two-protocol-options.diff
- removed patches (upstreamed)
. httpd-cache-forward-http-proxy.patch
. httpd-cache-revert-svn1773397.patch
-------------------------------------------------------------------
Fri Jun 2 07:36:43 UTC 2017 - pgajdos@suse.com

View File

@ -53,7 +53,7 @@
%define mods_static unixd
%endif
Name: apache2
Version: 2.4.25
Version: 2.4.26
Release: 0
Summary: The Apache Web Server Version 2.4
License: Apache-2.0
@ -129,10 +129,6 @@ Patch111: httpd-visibility.patch
Patch114: httpd-2.4.12-lua-5.2.patch
# PATCH-FEATURE-UPSTREAM kstreitova@suse.com -- backport of HttpContentLengthHeadZero and HttpExpectStrict
Patch115: httpd-2.4.x-fate317766-config-control-two-protocol-options.diff
# https://bz.apache.org/bugzilla/show_bug.cgi?id=60577 comment 5
Patch116: httpd-cache-forward-http-proxy.patch
# http://svn.apache.org/viewvc?view=revision&revision=1781324
Patch117: httpd-cache-revert-svn1773397.patch
BuildRequires: apache-rpm-macros-control
BuildRequires: automake
BuildRequires: db-devel
@ -322,8 +318,6 @@ to administrators of web servers in general.
%patch111 -p1
%patch114 -p1
%patch115 -p1
%patch116 -p0
%patch117 -p1
cat $RPM_SOURCE_DIR/SUSE-NOTICE >> NOTICE
# install READMEs
a=$(basename %{SOURCE22})
@ -1380,11 +1374,14 @@ exit 0
%if 0%{?suse_version} >= 1210
%service_del_preun apache2.target
%endif
for i in %{_sbindir}/httpd \
%{installbuilddir}/config_vars.mk
do
test -L $i && rm $i
done
# removing the symlink in case of uninstall (not upgrade) [bsc#1041830]
if [ $1 -eq 0 ]; then
for i in %{_sbindir}/httpd \
%{installbuilddir}/config_vars.mk
do
test -L $i && rm $i
done
fi
exit 0
%postun

View File

@ -1,8 +1,8 @@
Index: httpd-2.4.16/modules/lua/mod_lua.c
Index: httpd-2.4.26/modules/lua/mod_lua.c
===================================================================
--- httpd-2.4.16.orig/modules/lua/mod_lua.c
+++ httpd-2.4.16/modules/lua/mod_lua.c
@@ -1078,7 +1078,11 @@ static const char *register_named_block_
--- httpd-2.4.26.orig/modules/lua/mod_lua.c 2017-03-01 17:54:35.000000000 +0100
+++ httpd-2.4.26/modules/lua/mod_lua.c 2017-06-19 10:04:42.413328131 +0200
@@ -1086,7 +1086,11 @@ static const char *register_named_block_
lua_dump(lvm, ldump_writer, &b);
#endif
luaL_pushresult(&b);
@ -14,10 +14,10 @@ Index: httpd-2.4.16/modules/lua/mod_lua.c
spec->bytecode = apr_pstrmemdup(cmd->pool, lua_tostring(lvm, -1),
spec->bytecode_len);
lua_close(lvm);
Index: httpd-2.4.16/modules/lua/lua_apr.c
Index: httpd-2.4.26/modules/lua/lua_apr.c
===================================================================
--- httpd-2.4.16.orig/modules/lua/lua_apr.c
+++ httpd-2.4.16/modules/lua/lua_apr.c
--- httpd-2.4.26.orig/modules/lua/lua_apr.c 2014-09-05 16:20:27.000000000 +0200
+++ httpd-2.4.26/modules/lua/lua_apr.c 2017-06-19 10:04:42.413328131 +0200
@@ -82,7 +82,11 @@ static const luaL_Reg lua_table_methods[
int ap_lua_init(lua_State *L, apr_pool_t *p)
{
@ -30,11 +30,11 @@ Index: httpd-2.4.16/modules/lua/lua_apr.c
lua_pushstring(L, "__index");
lua_pushstring(L, "get");
lua_gettable(L, 2);
Index: httpd-2.4.16/modules/lua/lua_config.c
Index: httpd-2.4.26/modules/lua/lua_config.c
===================================================================
--- httpd-2.4.16.orig/modules/lua/lua_config.c
+++ httpd-2.4.16/modules/lua/lua_config.c
@@ -263,13 +263,20 @@ void ap_lua_load_config_lmodule(lua_Stat
--- httpd-2.4.26.orig/modules/lua/lua_config.c 2017-03-01 17:54:35.000000000 +0100
+++ httpd-2.4.26/modules/lua/lua_config.c 2017-06-19 10:04:42.413328131 +0200
@@ -265,13 +265,20 @@ void ap_lua_load_config_lmodule(lua_Stat
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
@ -56,35 +56,35 @@ Index: httpd-2.4.16/modules/lua/lua_config.c
+#endif
}
Index: httpd-2.4.16/modules/lua/lua_request.c
Index: httpd-2.4.26/modules/lua/lua_request.c
===================================================================
--- httpd-2.4.16.orig/modules/lua/lua_request.c
+++ httpd-2.4.16/modules/lua/lua_request.c
@@ -149,7 +149,11 @@ static int req_aprtable2luatable_cb(void
--- httpd-2.4.26.orig/modules/lua/lua_request.c 2017-03-01 17:54:35.000000000 +0100
+++ httpd-2.4.26/modules/lua/lua_request.c 2017-06-19 10:09:16.137841283 +0200
@@ -150,7 +150,11 @@ static int req_aprtable2luatable_cb(void
}
case LUA_TTABLE:{
/* [array, table<s,t>, table<s,s>] */
+#if LUA_VERSION_NUM < 502
int size = lua_objlen(L, -1);
+ int size = lua_objlen(L, -1);
+#else
+ int size = lua_rawlen(L, -1);
int size = lua_rawlen(L, -1);
+#endif
lua_pushnumber(L, size + 1); /* [#, array, table<s,t>, table<s,s>] */
lua_pushstring(L, value); /* [string, #, array, table<s,t>, table<s,s>] */
lua_settable(L, -3); /* [array, table<s,t>, table<s,s>] */
@@ -198,7 +202,11 @@ static int req_aprtable2luatable_cb_len(
}
@@ -200,7 +204,11 @@ static int req_aprtable2luatable_cb_len(
case LUA_TTABLE:{
/* [array, table<s,t>, table<s,s>] */
+#if LUA_VERSION_NUM < 502
int size = lua_objlen(L, -1);
+ int size = lua_objlen(L, -1);
+#else
+ int size = lua_rawlen(L, -1);
int size = lua_rawlen(L, -1);
+#endif
lua_pushnumber(L, size + 1); /* [#, array, table<s,t>, table<s,s>] */
lua_pushlstring(L, value, len); /* [string, #, array, table<s,t>, table<s,s>] */
lua_settable(L, -3); /* [array, table<s,t>, table<s,s>] */
@@ -346,7 +354,7 @@ static int req_parsebody(lua_State *L)
@@ -345,7 +353,7 @@ static int req_parsebody(lua_State *L)
char *multipart;
const char *contentType;
request_rec *r = ap_lua_check_request_rec(L, 1);
@ -93,7 +93,7 @@ Index: httpd-2.4.16/modules/lua/lua_request.c
multipart = apr_pcalloc(r->pool, 256);
contentType = apr_table_get(r->headers_in, "Content-Type");
lua_newtable(L);
@@ -419,7 +427,7 @@ static int lua_ap_requestbody(lua_State
@@ -418,7 +426,7 @@ static int lua_ap_requestbody(lua_State
r = ap_lua_check_request_rec(L, 1);
filename = luaL_optstring(L, 2, 0);
@ -102,7 +102,7 @@ Index: httpd-2.4.16/modules/lua/lua_request.c
if (r) {
apr_off_t size;
@@ -1709,7 +1717,7 @@ static int lua_ap_make_etag(lua_State *L
@@ -1708,7 +1716,7 @@ static int lua_ap_make_etag(lua_State *L
luaL_checktype(L, 1, LUA_TUSERDATA);
r = ap_lua_check_request_rec(L, 1);
luaL_checktype(L, 2, LUA_TBOOLEAN);
@ -120,7 +120,7 @@ Index: httpd-2.4.16/modules/lua/lua_request.c
lua_pop(L, 1);
/* secure */
@@ -2889,7 +2897,11 @@ void ap_lua_load_request_lmodule(lua_Sta
@@ -2959,7 +2967,11 @@ void ap_lua_load_request_lmodule(lua_Sta
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
@ -132,7 +132,7 @@ Index: httpd-2.4.16/modules/lua/lua_request.c
lua_pop(L, 2);
@@ -2897,7 +2909,11 @@ void ap_lua_load_request_lmodule(lua_Sta
@@ -2967,7 +2979,11 @@ void ap_lua_load_request_lmodule(lua_Sta
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
@ -144,7 +144,7 @@ Index: httpd-2.4.16/modules/lua/lua_request.c
lua_pop(L, 2);
@@ -2905,7 +2921,11 @@ void ap_lua_load_request_lmodule(lua_Sta
@@ -2975,7 +2991,11 @@ void ap_lua_load_request_lmodule(lua_Sta
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f87ec2df1c9fee3e6bfde3c8b855a3ddb7ca1ab20ca877bd0e2b6bf3f05c80b2
size 6398218

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIVAwUAWFQxfDTqduZ5FIWoAQq+zA/8Djunr33BoiQkAkm5p2XQTDrHniieR+SR
Sz4fD49bCVs64JDiheDWgaGP1qmRQtxb4IxBwjrwduZJgwTx4k0u3lw1QB31ISln
QV1ftnBq+sH3+dFYYyh/6ST2wvnU6MVgpG7ebQvpqLd2Z4djI4J+AMaa1bYRJCom
evrQUXIFxn7hRHIGk1KTNyaClyJPQsVjgqDzgyiEJ7SieIqx4DCkoRHar+0dKVfT
1mrjTLZTzihL9DJSgaJdDWw1ea3w68ea1SvNtGOysXLUlcjd7qiEP5KNw+QgfFga
8Cbz8KPneO18VNGUXY2J/66d5LO/AkOV/5ZAMi+KXLKZhcmrNu/Rw8bsbF2jHlP+
1X3l0cSj49jV9nuHZFUXOtO8iMXeEr5Sj8TKTOopQPCa6+Y5+vpCQjRXdjJYR/7+
BNey3BbRZAYQwFAeDvGIYos9QkYku1wswW1lgbzFtwR9MLcb3GZUyV7CKPNsIdpD
BeI5WtfCIvVZySV6tnnWjeeXPNSPa2uN7a9TgEshUvp7F4c4gljPLBnOKTjt6Ize
vm7Au0swwyknrqhPkZRtCtoypDng1j9qGeRI68g08WlPz43ODYfeSAekoruVK2fh
RQBQGO6B/7SSD9QK+3FDuSb+dVBIRD3tW8VcwQ8inhfAo1puXQu8csFXNRxb7QLf
JyWu1x0SKTQ=
=4O2t
-----END PGP SIGNATURE-----

3
httpd-2.4.26.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a07eb52fafc879e0149d31882f7da63173e72df4478db4dc69f7a775b663d387
size 6524642

16
httpd-2.4.26.tar.bz2.asc Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIVAwUAWUAgdTTqduZ5FIWoAQoBURAApIVUrOxo4xOE/c1Bk0ex4Ddu6HrL+dvz
gNlaqLovQYb0xXBUi9gpDQxD0juIPt6oLZSSIw2iceJc1LYVnjBnC5iHYxjG9Qnn
SHXsfN1VAWRFov8wajU+zPClirm3CHWYZ7VDXcPvz/7UAWzlB++kryNqqZU2HuJf
ahdjCLAM2TweWaQciP1Ow3h0xHgdXass5uDyEPu0PdCho4CJWEK8k9VJO6twcDhd
+PFmsgjgwFP5MJo/N86X1GW/s8/wcz0vCqGOs5qn54fCjwSovD939LLMIH5Dyo6S
KQ6kP9rd12wFIKRoc151rjAt+0jB5rOzGsh4+sTVAqmvZuFQ2xTkGD83fin2P4RC
D+PEJUkO+SznN1QcSZKJB6LYa2M/3VBnXXUl1maETgSkNoqoF0alL4fBKJWxC/wv
IPnNZJo0tCL+SGVBz6+st2V7O2/KHWeQ0JlHIDO9m6sO3EDUGbIsQHgaSihfDAM5
8R0YFsD3dLK9P0ZeXztAQL3dj396dRh79mmhIvTx9OM4nYC01HPh3VEZ4BFy2HDg
cFGdUn6mmTnDTVl2gZnIvTwM1RVg2JAf5v69UcrTAfs/SPjaH0LFRN29zzwHHoMq
fxwxmKOWpOFe2EbPXbr+mtg5xdTHdNpqn2gBZHhcIq2mmOJdAxHKl2SAvar3HU/J
SLPfbzU25UQ=
=A7FB
-----END PGP SIGNATURE-----

View File

@ -42,19 +42,11 @@ Conflicts:
server/protocol.c | 25 +++++++++++++++++--------
6 files changed, 77 insertions(+), 10 deletions(-)
Index: httpd-2.4.25/modules/http/http_filters.c
Index: httpd-2.4.26/modules/http/http_filters.c
===================================================================
--- httpd-2.4.25.orig/modules/http/http_filters.c 2016-12-15 13:18:59.000000000 +0100
+++ httpd-2.4.25/modules/http/http_filters.c 2017-01-02 10:54:37.608517377 +0100
@@ -1260,6 +1260,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_
const char *ctype;
ap_bucket_error *eb = NULL;
apr_bucket *eos = NULL;
+ core_server_config *conf;
AP_DEBUG_ASSERT(!r->main);
@@ -1441,10 +1442,17 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_
--- httpd-2.4.26.orig/modules/http/http_filters.c 2017-01-09 22:17:08.000000000 +0100
+++ httpd-2.4.26/modules/http/http_filters.c 2017-06-19 13:02:30.698399025 +0200
@@ -1472,10 +1472,17 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_
* zero C-L to the client. We can't just remove the C-L filter,
* because well behaved 2.0 handlers will send their data down the stack,
* and we will compute a real C-L for the head request. RBB
@ -64,7 +56,7 @@ Index: httpd-2.4.25/modules/http/http_filters.c
+ *
+ * The default (unset) behavior is to squelch the C-L in this case.
*/
+ conf = ap_get_core_module_config(r->server->module_config);
+ core_server_config *conf = ap_get_core_module_config(r->server->module_config);
if (r->header_only
&& (clheader = apr_table_get(r->headers_out, "Content-Length"))
- && !strcmp(clheader, "0")) {
@ -73,10 +65,10 @@ Index: httpd-2.4.25/modules/http/http_filters.c
apr_table_unset(r->headers_out, "Content-Length");
}
Index: httpd-2.4.25/server/core.c
Index: httpd-2.4.26/server/core.c
===================================================================
--- httpd-2.4.25.orig/server/core.c 2016-12-05 15:34:29.000000000 +0100
+++ httpd-2.4.25/server/core.c 2017-01-02 10:54:37.608517377 +0100
--- httpd-2.4.26.orig/server/core.c 2016-12-05 15:34:29.000000000 +0100
+++ httpd-2.4.26/server/core.c 2017-06-19 12:54:26.353988343 +0200
@@ -528,6 +528,12 @@ static void *merge_core_server_configs(a
if (virt->http_methods != AP_HTTP_METHODS_UNSET)
conf->http_methods = virt->http_methods;
@ -134,10 +126,10 @@ Index: httpd-2.4.25/server/core.c
AP_INIT_ITERATE("Protocols", set_protocols, NULL, RSRC_CONF,
"Controls which protocols are allowed"),
AP_INIT_TAKE1("ProtocolsHonorOrder", set_protocols_honor_order, NULL, RSRC_CONF,
Index: httpd-2.4.25/server/protocol.c
Index: httpd-2.4.26/server/protocol.c
===================================================================
--- httpd-2.4.25.orig/server/protocol.c 2016-12-12 16:22:49.000000000 +0100
+++ httpd-2.4.25/server/protocol.c 2017-01-02 10:54:37.608517377 +0100
--- httpd-2.4.26.orig/server/protocol.c 2017-05-30 14:27:41.000000000 +0200
+++ httpd-2.4.26/server/protocol.c 2017-06-19 12:54:26.353988343 +0200
@@ -1416,14 +1416,23 @@ request_rec *ap_read_request(conn_rec *c
r->expecting_100 = 1;
}
@ -170,10 +162,10 @@ Index: httpd-2.4.25/server/protocol.c
}
}
Index: httpd-2.4.25/include/http_core.h
Index: httpd-2.4.26/include/http_core.h
===================================================================
--- httpd-2.4.25.orig/include/http_core.h 2016-12-05 15:34:29.000000000 +0100
+++ httpd-2.4.25/include/http_core.h 2017-01-02 10:55:18.613603512 +0100
--- httpd-2.4.26.orig/include/http_core.h 2016-12-05 15:34:29.000000000 +0100
+++ httpd-2.4.26/include/http_core.h 2017-06-19 12:54:26.353988343 +0200
@@ -723,6 +723,16 @@ typedef struct {
#define AP_MERGE_TRAILERS_DISABLE 2
int merge_trailers;

View File

@ -1,317 +0,0 @@
https://bz.apache.org/bugzilla/show_bug.cgi?id=60577 comment 5
--- modules/cache/cache_storage.c (revision 1783795)
+++ modules/cache/cache_storage.c (working copy)
@@ -427,7 +427,7 @@ int cache_select(cache_request_rec *cache, request
}
static apr_status_t cache_canonicalise_key(request_rec *r, apr_pool_t* p,
- const char *uri, const char *query,
+ const char *path, const char *query,
apr_uri_t *parsed_uri,
const char **key)
{
@@ -435,8 +435,8 @@ static apr_status_t cache_canonicalise_key(request
char *port_str, *hn, *lcs;
const char *hostname, *scheme;
int i;
- const char *path;
- char *querystring;
+ const char *kpath;
+ const char *kquery;
if (*key) {
/*
@@ -564,8 +564,8 @@ static apr_status_t cache_canonicalise_key(request
* Check if we need to ignore session identifiers in the URL and do so
* if needed.
*/
- path = uri;
- querystring = apr_pstrdup(p, query ? query : parsed_uri->query);
+ kpath = path;
+ kquery = conf->ignorequerystring ? NULL : query;
if (conf->ignore_session_id->nelts) {
int i;
char **identifier;
@@ -580,24 +580,23 @@ static apr_status_t cache_canonicalise_key(request
* Check that we have a parameter separator in the last segment
* of the path and that the parameter matches our identifier
*/
- if ((param = ap_strrchr_c(path, ';'))
+ if ((param = ap_strrchr_c(kpath, ';'))
&& !strncmp(param + 1, *identifier, len)
&& (*(param + len + 1) == '=')
&& !ap_strchr_c(param + len + 2, '/')) {
- path = apr_pstrmemdup(p, path, param - path);
+ kpath = apr_pstrmemdup(p, kpath, param - kpath);
continue;
}
/*
- * Check if the identifier is in the querystring and cut it out.
+ * Check if the identifier is in the query string and cut it out.
*/
- if (querystring && *querystring) {
+ if (kquery && *kquery) {
/*
* First check if the identifier is at the beginning of the
- * querystring and followed by a '='
+ * query string and followed by a '='
*/
- if (!strncmp(querystring, *identifier, len)
- && (*(querystring + len) == '=')) {
- param = querystring;
+ if (!strncmp(kquery, *identifier, len) && kquery[len] == '=') {
+ param = kquery;
}
else {
char *complete;
@@ -607,7 +606,7 @@ static apr_status_t cache_canonicalise_key(request
* identifier with a '&' and append a '='
*/
complete = apr_pstrcat(p, "&", *identifier, "=", NULL);
- param = ap_strstr_c(querystring, complete);
+ param = ap_strstr_c(kquery, complete);
/* If we found something we are sitting on the '&' */
if (param) {
param++;
@@ -615,28 +614,28 @@ static apr_status_t cache_canonicalise_key(request
}
if (param) {
const char *amp;
+ char *dup = NULL;
- if (querystring != param) {
- querystring = apr_pstrndup(p, querystring,
- param - querystring);
+ if (kquery != param) {
+ dup = apr_pstrmemdup(p, kquery, param - kquery);
+ kquery = dup;
}
else {
- querystring = "";
+ kquery = "";
}
if ((amp = ap_strchr_c(param + len + 1, '&'))) {
- querystring = apr_pstrcat(p, querystring, amp + 1,
- NULL);
+ kquery = apr_pstrcat(p, kquery, amp + 1, NULL);
}
else {
/*
- * If querystring is not "", then we have the case
+ * If query string is not "", then we have the case
* that the identifier parameter we removed was the
- * last one in the original querystring. Hence we have
+ * last one in the original query string. Hence we have
* a trailing '&' which needs to be removed.
*/
- if (*querystring) {
- querystring[strlen(querystring) - 1] = '\0';
+ if (dup) {
+ dup[strlen(dup) - 1] = '\0';
}
}
}
@@ -644,15 +643,11 @@ static apr_status_t cache_canonicalise_key(request
}
}
- /* Key format is a URI, optionally without the query-string */
- if (conf->ignorequerystring) {
- *key = apr_pstrcat(p, scheme, "://", hostname, port_str, path, "?",
- NULL);
- }
- else {
- *key = apr_pstrcat(p, scheme, "://", hostname, port_str, path, "?",
- querystring, NULL);
- }
+ /* Key format is a URI, optionally without the query-string (NULL
+ * per above if conf->ignorequerystring)
+ */
+ *key = apr_pstrcat(p, scheme, "://", hostname, port_str,
+ kpath, "?", kquery, NULL);
/*
* Store the key in the request_config for the cache as r->parsed_uri
@@ -662,20 +657,26 @@ static apr_status_t cache_canonicalise_key(request
* resource in the cache under a key where it is never found by the quick
* handler during following requests.
*/
- ap_log_rerror(
- APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r, APLOGNO(00698) "cache: Key for entity %s?%s is %s", uri, parsed_uri->query, *key);
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r, APLOGNO(00698)
+ "cache: Key for entity %s?%s is %s", path, query, *key);
return APR_SUCCESS;
}
apr_status_t cache_generate_key_default(request_rec *r, apr_pool_t* p,
- const char **key)
+ const char **key)
{
- /* We want the actual query-string, which may differ from
- * r->parsed_uri.query (immutable), so use "" (not NULL).
+ /* In early processing (quick-handler, forward proxy), we want the initial
+ * query-string from r->parsed_uri, since any change before CACHE_SAVE
+ * shouldn't modify the key. Otherwise we want the actual query-string.
*/
- const char *args = r->args ? r->args : "";
- return cache_canonicalise_key(r, p, r->uri, args, &r->parsed_uri, key);
+ const char *path = r->uri;
+ const char *query = r->args;
+ if (cache_use_early_url(r)) {
+ path = r->parsed_uri.path;
+ query = r->parsed_uri.query;
+ }
+ return cache_canonicalise_key(r, p, path, query, &r->parsed_uri, key);
}
/*
@@ -717,7 +718,8 @@ int cache_invalidate(cache_request_rec *cache, req
if (location) {
if (apr_uri_parse(r->pool, location, &location_uri)
|| cache_canonicalise_key(r, r->pool,
- location, NULL,
+ location_uri.path,
+ location_uri.query,
&location_uri, &location_key)
|| !(r->parsed_uri.hostname
&& location_uri.hostname
@@ -732,7 +734,8 @@ int cache_invalidate(cache_request_rec *cache, req
if (apr_uri_parse(r->pool, content_location,
&content_location_uri)
|| cache_canonicalise_key(r, r->pool,
- content_location, NULL,
+ content_location_uri.path,
+ content_location_uri.query,
&content_location_uri,
&content_location_key)
|| !(r->parsed_uri.hostname
--- modules/cache/cache_util.c (revision 1783795)
+++ modules/cache/cache_util.c (working copy)
@@ -31,10 +31,8 @@ extern module AP_MODULE_DECLARE_DATA cache_module;
* in "filter". All but the path comparisons are case-insensitive.
*/
static int uri_meets_conditions(const apr_uri_t *filter, const int pathlen,
- request_rec *r)
+ const apr_uri_t *url, const char *path)
{
- const apr_uri_t *url = &r->parsed_uri;
-
/* Scheme, hostname port and local part. The filter URI and the
* URI we test may have the following shapes:
* /<path>
@@ -114,7 +112,7 @@ static int uri_meets_conditions(const apr_uri_t *f
/* For HTTP caching purposes, an empty (NULL) path is equivalent to
* a single "/" path. RFCs 3986/2396
*/
- if (!r->uri) {
+ if (!path) {
if (*filter->path == '/' && pathlen == 1) {
return 1;
}
@@ -126,9 +124,25 @@ static int uri_meets_conditions(const apr_uri_t *f
/* Url has met all of the filter conditions so far, determine
* if the paths match.
*/
- return !strncmp(filter->path, r->uri, pathlen);
+ return !strncmp(filter->path, path, pathlen);
}
+int cache_use_early_url(request_rec *r)
+{
+ cache_server_conf *conf;
+
+ if (r->proxyreq == PROXYREQ_PROXY) {
+ return 1;
+ }
+
+ conf = ap_get_module_config(r->server->module_config, &cache_module);
+ if (conf->quick) {
+ return 1;
+ }
+
+ return 0;
+}
+
static cache_provider_list *get_provider(request_rec *r, struct cache_enable *ent,
cache_provider_list *providers)
{
@@ -172,6 +186,7 @@ cache_provider_list *cache_get_providers(request_r
{
cache_dir_conf *dconf = ap_get_module_config(r->per_dir_config, &cache_module);
cache_provider_list *providers = NULL;
+ const char *path;
int i;
/* per directory cache disable */
@@ -179,11 +194,14 @@ cache_provider_list *cache_get_providers(request_r
return NULL;
}
+ path = cache_use_early_url(r) ? r->parsed_uri.path : r->uri;
+
/* global cache disable */
for (i = 0; i < conf->cachedisable->nelts; i++) {
struct cache_disable *ent =
(struct cache_disable *)conf->cachedisable->elts;
- if (uri_meets_conditions(&ent[i].url, ent[i].pathlen, r)) {
+ if (uri_meets_conditions(&ent[i].url, ent[i].pathlen,
+ &r->parsed_uri, path)) {
/* Stop searching now. */
return NULL;
}
@@ -200,7 +218,8 @@ cache_provider_list *cache_get_providers(request_r
for (i = 0; i < conf->cacheenable->nelts; i++) {
struct cache_enable *ent =
(struct cache_enable *)conf->cacheenable->elts;
- if (uri_meets_conditions(&ent[i].url, ent[i].pathlen, r)) {
+ if (uri_meets_conditions(&ent[i].url, ent[i].pathlen,
+ &r->parsed_uri, path)) {
providers = get_provider(r, &ent[i], providers);
}
}
--- modules/cache/cache_util.h (revision 1783795)
+++ modules/cache/cache_util.h (working copy)
@@ -327,6 +327,12 @@ char *cache_strqtok(char *str, const char *sep, ch
*/
apr_table_t *cache_merge_headers_out(request_rec *r);
+/**
+ * Return whether to use request's path/query from early stage (r->parsed_uri)
+ * or the current/rewritable ones (r->uri/r->args).
+ */
+int cache_use_early_url(request_rec *r);
+
#ifdef __cplusplus
}
#endif
--- modules/cache/mod_cache.c (revision 1783795)
+++ modules/cache/mod_cache.c (working copy)
@@ -823,6 +823,7 @@ static apr_status_t cache_save_filter(ap_filter_t
apr_pool_t *p;
apr_bucket *e;
apr_table_t *headers;
+ const char *query;
conf = (cache_server_conf *) ap_get_module_config(r->server->module_config,
&cache_module);
@@ -927,6 +928,8 @@ static apr_status_t cache_save_filter(ap_filter_t
}
}
+ query = cache_use_early_url(r) ? r->parsed_uri.query : r->args;
+
/* read expiry date; if a bad date, then leave it so the client can
* read it
*/
@@ -1057,7 +1060,7 @@ static apr_status_t cache_save_filter(ap_filter_t
reason
= "s-maxage or max-age zero and no Last-Modified or Etag; not cacheable";
}
- else if (!conf->ignorequerystring && r->parsed_uri.query && exps == NULL
+ else if (!conf->ignorequerystring && query && exps == NULL
&& !control.max_age && !control.s_maxage) {
/* if a query string is present but no explicit expiration time,
* don't cache it (RFC 2616/13.9 & 13.2.1)

View File

@ -1,38 +0,0 @@
Index: httpd-2.4.25/modules/proxy/mod_proxy.c
===================================================================
--- httpd-2.4.25.orig/modules/proxy/mod_proxy.c 2016-12-12 16:20:04.000000000 +0100
+++ httpd-2.4.25/modules/proxy/mod_proxy.c 2017-02-23 15:02:21.509606618 +0100
@@ -771,29 +771,18 @@ static int proxy_trans(request_rec *r)
*/
dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
- conf = (proxy_server_conf *) ap_get_module_config(r->server->module_config,
- &proxy_module);
+
/* short way - this location is reverse proxied? */
if (dconf->alias) {
int rv = ap_proxy_trans_match(r, dconf->alias, dconf);
- if (OK == rv) {
- /* Got a hit. Need to make sure it's not explicitly declined */
- if (conf->aliases->nelts) {
- ent = (struct proxy_alias *) conf->aliases->elts;
- for (i = 0; i < conf->aliases->nelts; i++) {
- int rv = ap_proxy_trans_match(r, &ent[i], dconf);
- if (DECLINED == rv) {
- return DECLINED;
- }
- }
- }
- return OK;
- }
if (DONE != rv) {
return rv;
}
}
+ conf = (proxy_server_conf *) ap_get_module_config(r->server->module_config,
+ &proxy_module);
+
/* long way - walk the list of aliases, find a match */
if (conf->aliases->nelts) {
ent = (struct proxy_alias *) conf->aliases->elts;