From 311e2ea0062bf09d6f78f5458eeb14dbc6c092ea Mon Sep 17 00:00:00 2001 From: Tay Ray Chuan Date: Sat, 25 Sep 2010 12:20:35 +0800 Subject: smart-http: Don't change POST to GET when following redirect For a long time (29508e1 "Isolate shared HTTP request functionality", Fri Nov 18 11:02:58 2005), we've followed HTTP redirects with CURLOPT_FOLLOWLOCATION. However, when the remote HTTP server returns a redirect the default libcurl action is to change a POST request into a GET request while following the redirect, but the remote http backend does not expect that. Fix this by telling libcurl to always keep the request as type POST with CURLOPT_POSTREDIR. For users of libcurl older than 7.19.1, use CURLOPT_POST301 instead, which only follows 301s instead of both 301s and 302s. Signed-off-by: Andreas Schwab Signed-off-by: Tay Ray Chuan Signed-off-by: Junio C Hamano --- t/lib-httpd/apache.conf | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't/lib-httpd') diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf index 4961505d1d..f41c7c674c 100644 --- a/t/lib-httpd/apache.conf +++ b/t/lib-httpd/apache.conf @@ -17,6 +17,9 @@ ErrorLog error.log LoadModule env_module modules/mod_env.so + + LoadModule rewrite_module modules/mod_rewrite.so + Alias /dumb/ www/ @@ -36,6 +39,10 @@ ScriptAlias /smart_noexport/ ${GIT_EXEC_PATH}/git-http-backend/ Options ExecCGI +RewriteEngine on +RewriteRule ^/smart-redir-perm/(.*)$ /smart/$1 [R=301] +RewriteRule ^/smart-redir-temp/(.*)$ /smart/$1 [R=302] + LoadModule ssl_module modules/mod_ssl.so -- cgit v1.2.3