From 0771d643c3b454831f319f0697b20615b14150b3 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 15 Oct 2012 11:14:26 +1100 Subject: [PATCH] Rename $wgPurgeHttp11 to $wgSquidPurgeUseHostHeader Rename $wgPurgeHttp11 to $wgSquidPurgeUseHostHeader, set it to true by default, and update the documentation per the research I've done on Squid's behaviour. See bug 39005. Rewrote the release note and moved it to the correct section. Change-Id: I9ef6a0c43fc1ba4547b34124a47815296f45b20e --- RELEASE-NOTES-1.21 | 8 +++++--- includes/DefaultSettings.php | 23 ++++++++++++++++++----- includes/SquidPurgeClient.php | 4 ++-- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index b9fc4585cf..d8f65068d1 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -14,9 +14,6 @@ production. * (bug 29374) $wgVectorUseSimpleSearch is now enabled by default. * Deprecated $wgAllowRealName is removed. Use $wgHiddenPrefs[] = 'realname' instead. -* Added a $wgPurgeHttp11 setting to allow SquidPurgeClient to send PURGE requests - using HTTP/1.1 and a Host header instead of sending HTTP/1.0 requests with the - whole url inside the PURGE <...> HTTP/1.0 line. === New features in 1.21 === * (bug 34876) jquery.makeCollapsible has been improved in performance. @@ -38,6 +35,11 @@ production. recentchanges table. * (bug 32951) Do not register internal externals with absolute protocol, when server has relative protocol. +* (bug 39005) When purging proxies listed in $wgSquidServers using HTTP PURGE + method requests, we now send a Host header by default, for Varnish + compatibility. This also works with Squid in reverse-proxy mode. If you wish + to support Squid configured in forward-proxy mode, set + $wgSquidPurgeUseHostHeader to false. === API changes in 1.21 === * prop=revisions can now report the contentmodel and contentformat, see docs/contenthandler.txt diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 598c346d4d..320ce625f7 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2059,12 +2059,25 @@ $wgSquidServersNoPurge = array(); $wgMaxSquidPurgeTitles = 400; /** - * Whether to use HTTP/1.1 for squid purge requests - * false - Use HTTP/1.0 with a full url in the PURGE request. - * true - Use HTTP/1.1 with a Host header and PURGE path. - * @since 1.20 + * Whether to use a Host header in purge requests sent to the proxy servers + * configured in $wgSquidServers. Set this to false to support Squid + * configured in forward-proxy mode. + * + * If this is set to true, a Host header will be sent, and only the path + * component of the URL will appear on the request line, as if the request + * were a non-proxy HTTP 1.1 request. Varnish only supports this style of + * request. Squid supports this style of request only if reverse-proxy mode + * (http_port ... accel) is enabled. + * + * If this is set to false, no Host header will be sent, and the absolute URL + * will be sent in the request line, as is the standard for an HTTP proxy + * request in both HTTP 1.0 and 1.1. This style of request is not supported + * by Varnish, but is supported by Squid in either configuration (forward or + * reverse). + * + * @since 1.21 */ -$wgPurgeHttp11 = false; +$wgSquidPurgeUseHostHeader = true; /** * Routing configuration for HTCP multicast purging. Add elements here to diff --git a/includes/SquidPurgeClient.php b/includes/SquidPurgeClient.php index cb33ead943..7d75f2ca9a 100644 --- a/includes/SquidPurgeClient.php +++ b/includes/SquidPurgeClient.php @@ -176,10 +176,10 @@ class SquidPurgeClient { * @param $url string */ public function queuePurge( $url ) { - global $wgPurgeHttp11; + global $wgSquidPurgeUseHostHeader; $url = SquidUpdate::expand( str_replace( "\n", '', $url ) ); $request = array(); - if ( $wgPurgeHttp11 ) { + if ( $wgSquidPurgeUseHostHeader ) { $url = wfParseUrl( $url ); $host = $url['host']; if ( isset( $url['port'] ) && strlen( $url['port'] ) > 0 ) { -- 2.20.1