File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,11 @@ static CURL *get_curl_handle(void)
279
279
}
280
280
281
281
curl_easy_setopt (result , CURLOPT_FOLLOWLOCATION , 1 );
282
+ #if LIBCURL_VERSION_NUM >= 0x071301
283
+ curl_easy_setopt (result , CURLOPT_POSTREDIR , CURL_REDIR_POST_ALL );
284
+ #elif LIBCURL_VERSION_NUM >= 0x071101
285
+ curl_easy_setopt (result , CURLOPT_POST301 , 1 );
286
+ #endif
282
287
283
288
if (getenv ("GIT_CURL_VERBOSE" ))
284
289
curl_easy_setopt (result , CURLOPT_VERBOSE , 1 );
Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ ErrorLog error.log
17
17
<IfModule !mod_env.c>
18
18
LoadModule env_module modules/mod_env.so
19
19
</IfModule>
20
+ <IfModule !mod_rewrite.c>
21
+ LoadModule rewrite_module modules/mod_rewrite.so
22
+ </IFModule>
20
23
21
24
Alias /dumb/ www/
22
25
@@ -36,6 +39,10 @@ ScriptAlias /smart_noexport/ ${GIT_EXEC_PATH}/git-http-backend/
36
39
Options ExecCGI
37
40
</Files>
38
41
42
+ RewriteEngine on
43
+ RewriteRule ^/smart-redir-perm/(.*)$ /smart/$1 [R=301]
44
+ RewriteRule ^/smart-redir-temp/(.*)$ /smart/$1 [R=302]
45
+
39
46
<IfDefine SSL>
40
47
LoadModule ssl_module modules/mod_ssl.so
41
48
Original file line number Diff line number Diff line change @@ -101,5 +101,13 @@ test_expect_success 'used upload-pack service' '
101
101
test_cmp exp act
102
102
'
103
103
104
+ test_expect_success ' follow redirects (301)' '
105
+ git clone $HTTPD_URL/smart-redir-perm/repo.git --quiet repo-p
106
+ '
107
+
108
+ test_expect_success ' follow redirects (302)' '
109
+ git clone $HTTPD_URL/smart-redir-temp/repo.git --quiet repo-t
110
+ '
111
+
104
112
stop_httpd
105
113
test_done
You can’t perform that action at this time.
0 commit comments