Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3BEDB17A10 for ; Thu, 21 May 2015 16:35:12 +0000 (UTC) Received: (qmail 53834 invoked by uid 500); 21 May 2015 16:35:12 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 53767 invoked by uid 500); 21 May 2015 16:35:12 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 53757 invoked by uid 99); 21 May 2015 16:35:12 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 May 2015 16:35:12 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id DDADBAC0623 for ; Thu, 21 May 2015 16:35:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1680923 - in /httpd/httpd/branches/2.2.x: ./ CHANGES STATUS include/ap_mmn.h modules/proxy/mod_proxy.h modules/proxy/mod_proxy_http.c modules/proxy/proxy_util.c Date: Thu, 21 May 2015 16:35:11 -0000 To: cvs@httpd.apache.org From: ylavic@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150521163511.DDADBAC0623@hades.apache.org> Author: ylavic Date: Thu May 21 16:35:11 2015 New Revision: 1680923 URL: http://svn.apache.org/r1680923 Log: Merge r1526189, r1658765 from trunk. r1526189 | trawick | 2013-09-25 16:29:02 +0200 (Wed, 25 Sep 2013) | 8 lines mod_proxy: Add ap_connection_reusable() for checking if a connection is reusable as of this point in processing. mod_proxy_fcgi uses the new API to determine if FCGI_CONN_CLOSE should be enabled, but that doesn't change existing behavior since the connection is currently marked for closure elsewhere in the module. r1658765 | ylavic | 2015-02-10 18:25:54 +0100 (Tue, 10 Feb 2015) | 4 lines mod_proxy_http: Use the "Connection: close" header for requests to backends not recycling connections (disablereuse), including the default reverse and forward proxies. Reviewed by: ylavic, wrowe, rjung Backported by: ylavic Modified: httpd/httpd/branches/2.2.x/ (props changed) httpd/httpd/branches/2.2.x/CHANGES httpd/httpd/branches/2.2.x/STATUS httpd/httpd/branches/2.2.x/include/ap_mmn.h httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c Propchange: httpd/httpd/branches/2.2.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu May 21 16:35:11 2015 @@ -1,2 +1,2 @@ /httpd/httpd/branches/2.4.x:1555538,1555559,1648845,1649003 -/httpd/httpd/trunk:290940,395552,417988,451572,501364,583817,583830,611483,630858,639005,639010,647395,657354,657459,660461,660566,664330,678761,680082,681190,682369,683626,685112,686805,686809,687099,687754,693120,693392,693727-693728,696006,697093,706318,707163,708902,711421,713575,719357,720250,729316-729317,729586,732414,732504,732816,732832,733127,733134,733218-733219,734710,743589,755190,756671,756675,756678,756683,757741,761329,763394,764239,768535,769809,771587,771610,776325,777042,777091,778438-778439,778531,778942,780648,780655,780692,780697,780699,785457,785661,790587,803704,819480,823536,823563,834378,835046,891282,900022,932791,942209,952823,953311,955966,981084,992625,1026743,1031551,1040304,1040373,1058192,1070096,1082189,1082196,1090645,1172732,1200040,1200372,1200374,1213380,1222335,1223048,1231446,1244211,1294306,1299738,1300171,1301111,1308862,1327036,1327080,1328133,1328325-1328326,1345319,1348656,1349905,1352912,1363183,1363186,1366344,1367778,1368131,1368396,13 69568,1395225,1398066,1400700,1408402,1410681,1413732,1414094,1416889,1418752,1422234,1422253,1435178,1447426,1470940,1475878,1476604,1476621,1476642,1476644-1476645,1477530,1485409,1485668,1490994,1493330,1496429,1500323,1504276,1506714,1509872,1509875,1524192,1524770,1526168,1527291,1527295,1527925,1528718,1529559,1531505,1532816,1551714,1552227,1553204,1554276,1554281,1555240,1555555,1556428,1563420,1572092,1572198,1572543,1572611,1572630,1572655,1572663,1572668-1572671,1572896,1572911,1572967,1573224,1573229,1575400,1586745,1587594,1587639,1588851,1590509,1603156,1604353,1610207,1610311,1610491,1610501,1620932,1621453,1648840,1649001,1649043,1650310,1650320,1653997,1666363,1676654,1677462,1679470 +/httpd/httpd/trunk:290940,395552,417988,451572,501364,583817,583830,611483,630858,639005,639010,647395,657354,657459,660461,660566,664330,678761,680082,681190,682369,683626,685112,686805,686809,687099,687754,693120,693392,693727-693728,696006,697093,706318,707163,708902,711421,713575,719357,720250,729316-729317,729586,732414,732504,732816,732832,733127,733134,733218-733219,734710,743589,755190,756671,756675,756678,756683,757741,761329,763394,764239,768535,769809,771587,771610,776325,777042,777091,778438-778439,778531,778942,780648,780655,780692,780697,780699,785457,785661,790587,803704,819480,823536,823563,834378,835046,891282,900022,932791,942209,952823,953311,955966,981084,992625,1026743,1031551,1040304,1040373,1058192,1070096,1082189,1082196,1090645,1172732,1200040,1200372,1200374,1213380,1222335,1223048,1231446,1244211,1294306,1299738,1300171,1301111,1308862,1327036,1327080,1328133,1328325-1328326,1345319,1348656,1349905,1352912,1363183,1363186,1366344,1367778,1368131,1368396,13 69568,1395225,1398066,1400700,1408402,1410681,1413732,1414094,1416889,1418752,1422234,1422253,1435178,1447426,1470940,1475878,1476604,1476621,1476642,1476644-1476645,1477530,1485409,1485668,1490994,1493330,1496429,1500323,1504276,1506714,1509872,1509875,1524192,1524770,1526168,1526189,1527291,1527295,1527925,1528718,1529559,1531505,1532816,1551714,1552227,1553204,1554276,1554281,1555240,1555555,1556428,1563420,1572092,1572198,1572543,1572611,1572630,1572655,1572663,1572668-1572671,1572896,1572911,1572967,1573224,1573229,1575400,1586745,1587594,1587639,1588851,1590509,1603156,1604353,1610207,1610311,1610491,1610501,1620932,1621453,1648840,1649001,1649043,1650310,1650320,1653997,1658765,1666363,1676654,1677462,1679470 Modified: httpd/httpd/branches/2.2.x/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=1680923&r1=1680922&r2=1680923&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original) +++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Thu May 21 16:35:11 2015 @@ -1,6 +1,13 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.30 + *) mod_proxy_http: Use the "Connection: close" header for requests to + backends not recycling connections (disablereuse), including the default + reverse and forward proxies. [Yann Ylavic] + + *) mod_proxy: Add ap_connection_reusable() for checking if a connection + is reusable as of this point in processing. [Jeff Trawick] + *) mod_proxy: Reuse proxy/balancer workers' parameters and scores across graceful restarts, even if new workers are added, old ones removed, or the order changes. [Jan Kaluza, Yann Ylavic] Modified: httpd/httpd/branches/2.2.x/STATUS URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1680923&r1=1680922&r2=1680923&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/STATUS (original) +++ httpd/httpd/branches/2.2.x/STATUS Thu May 21 16:35:11 2015 @@ -118,15 +118,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: vulnerable per se (no ErrorDocument handling from early request line parser), better be safe than sorry. - * mod_proxy_http: Use the "Connection: close" header for requests to - backends not recycling connections (disablereuse), including the default - reverse and forward proxies. - trunk patch: http://svn.apache.org/r1526189 - http://svn.apache.org/r1658765 - 2.4.x patch: merged in http://svn.apache.org/r1673896 - 2.2.x patch: http://people.apache.org/~ylavic/httpd-2.2.x-ap_proxy_connection_reusable.patch - +1: ylavic, wrowe, rjung - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] Modified: httpd/httpd/branches/2.2.x/include/ap_mmn.h URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/ap_mmn.h?rev=1680923&r1=1680922&r2=1680923&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/include/ap_mmn.h (original) +++ httpd/httpd/branches/2.2.x/include/ap_mmn.h Thu May 21 16:35:11 2015 @@ -156,6 +156,7 @@ * 20051115.36 (2.2.28) Add r->trailers_{in,out} * 20051115.37 (2.2.30) Add ap_get_server_name_for_url() * 20051115.38 (2.2.30) Add ap_proxy_set_scoreboard_lb() in mod_proxy.h + * 20051115.39 (2.2.30) Add ap_proxy_connection_reusable() */ #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */ @@ -163,7 +164,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20051115 #endif -#define MODULE_MAGIC_NUMBER_MINOR 38 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 39 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h?rev=1680923&r1=1680922&r2=1680923&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h (original) +++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h Thu May 21 16:35:11 2015 @@ -742,6 +742,17 @@ PROXY_DECLARE(int) ap_proxy_connect_back PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function, proxy_conn_rec *conn, conn_rec *c, server_rec *s); + +/** + * Determine if proxy connection can potentially be reused at the + * end of this request. + * @param conn proxy connection + * @return non-zero if reusable, 0 otherwise + * @note Even if this function returns non-zero, the connection may + * be subsequently marked for closure. + */ +PROXY_DECLARE(int) ap_proxy_connection_reusable(proxy_conn_rec *conn); + /** * Signal the upstream chain that the connection to the backend broke in the * middle of the response. This is done by sending an error bucket with Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c?rev=1680923&r1=1680922&r2=1680923&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c (original) +++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_http.c Thu May 21 16:35:11 2015 @@ -1122,7 +1122,7 @@ skip_body: * otherwise sent Connection: Keep-Alive. */ if (!force10) { - if (p_conn->close || p_conn->close_on_recycle) { + if (!ap_proxy_connection_reusable(p_conn)) { buf = apr_pstrdup(p, "Connection: close" CRLF); } else { Modified: httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c?rev=1680923&r1=1680922&r2=1680923&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c (original) +++ httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c Thu May 21 16:35:11 2015 @@ -1647,6 +1647,14 @@ PROXY_DECLARE(int) ap_proxy_connect_to_b return connected ? 0 : 1; } +PROXY_DECLARE(int) ap_proxy_connection_reusable(proxy_conn_rec *conn) +{ + proxy_worker *worker = conn->worker; + + return ! (conn->close || conn->close_on_recycle + || !worker->is_address_reusable || worker->disablereuse); +} + static apr_status_t connection_cleanup(void *theconn) { proxy_conn_rec *conn = (proxy_conn_rec *)theconn; @@ -1672,8 +1680,7 @@ static apr_status_t connection_cleanup(v #endif /* determine if the connection need to be closed */ - if (conn->close_on_recycle || conn->close || worker->disablereuse || - !worker->is_address_reusable) { + if (!ap_proxy_connection_reusable(conn)) { apr_pool_t *p = conn->pool; apr_pool_clear(p); conn = apr_pcalloc(p, sizeof(proxy_conn_rec));