From: Junio C Hamano Date: Wed, 8 Dec 2010 19:24:14 +0000 (-0800) Subject: Merge branch 'gc/http-with-non-ascii-username-url' X-Git-Tag: v1.7.4-rc0~78 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=16c06fcb39eec5505c383b412ca2254bccf354a5;hp=-c;p=git.git Merge branch 'gc/http-with-non-ascii-username-url' * gc/http-with-non-ascii-username-url: Fix username and password extraction from HTTP URLs t5550: test HTTP authentication and userinfo decoding Conflicts: t/lib-httpd/apache.conf --- 16c06fcb39eec5505c383b412ca2254bccf354a5 diff --combined http.c index 17bcf19c5,c9393a847..f582b13b9 --- a/http.c +++ b/http.c @@@ -2,6 -2,7 +2,7 @@@ #include "pack.h" #include "sideband.h" #include "run-command.h" + #include "url.h" int data_received; int active_requests; @@@ -279,11 -280,6 +280,11 @@@ static CURL *get_curl_handle(void } curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1); +#if LIBCURL_VERSION_NUM >= 0x071301 + curl_easy_setopt(result, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL); +#elif LIBCURL_VERSION_NUM >= 0x071101 + curl_easy_setopt(result, CURLOPT_POST301, 1); +#endif if (getenv("GIT_CURL_VERBOSE")) curl_easy_setopt(result, CURLOPT_VERBOSE, 1); @@@ -302,7 -298,7 +303,7 @@@ static void http_auth_init(const char *url) { - char *at, *colon, *cp, *slash; + char *at, *colon, *cp, *slash, *decoded; int len; cp = strstr(url, "://"); @@@ -327,16 -323,25 +328,25 @@@ user_name = xmalloc(len + 1); memcpy(user_name, cp, len); user_name[len] = '\0'; + decoded = url_decode(user_name); + free(user_name); + user_name = decoded; user_pass = NULL; } else { len = colon - cp; user_name = xmalloc(len + 1); memcpy(user_name, cp, len); user_name[len] = '\0'; + decoded = url_decode(user_name); + free(user_name); + user_name = decoded; len = at - (colon + 1); user_pass = xmalloc(len + 1); memcpy(user_pass, colon + 1, len); user_pass[len] = '\0'; + decoded = url_decode(user_pass); + free(user_pass); + user_pass = decoded; } } diff --combined t/lib-httpd/apache.conf index f41c7c674,b40e43bb3..0a4cdfa93 --- a/t/lib-httpd/apache.conf +++ b/t/lib-httpd/apache.conf @@@ -17,11 -17,30 +17,33 @@@ ErrorLog error.lo LoadModule env_module modules/mod_env.so + + LoadModule rewrite_module modules/mod_rewrite.so + + + LoadModule version_module modules/mod_version.so + + + + + LoadModule auth_module modules/mod_auth.so + + + + = 2.1> + + LoadModule auth_basic_module modules/mod_auth_basic.so + + + LoadModule authn_file_module modules/mod_authn_file.so + + + LoadModule authz_user_module modules/mod_authz_user.so + + Alias /dumb/ www/ + Alias /auth/ www/auth/ SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH} @@@ -39,10 -58,6 +61,10 @@@ ScriptAlias /smart_noexport/ ${GIT_EXEC 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 @@@ -55,6 -70,13 +77,13 @@@ SSLMutex file:ssl_mute SSLEngine On + + AuthType Basic + AuthName "git-auth" + AuthUserFile passwd + Require valid-user + + LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so