Skip to content

Commit 666aae9

Browse files
peffgitster
authored andcommitted
t/lib-httpd: recognize */smart/* repos as smart-http
We do not currently test authentication for smart-http repos at all. Part of the infrastructure to do this is recognizing that auth/smart is indeed a smart-http repo. The current apache config recognizes only "^/smart/*" as smart-http. Let's instead treat anything with /smart/ in the URL as smart-http. This is obviously a stupid thing to do for a real production site, but for our test suite we know that our repositories will not have this magic string in the name. Note that we will route /foo/smart/bar.git directly to git-http-backend/bar.git; in other words, everything before the "/smart/" is irrelevant to finding the repo on disk (but may impact apache config, for example by triggering auth checks). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 05b5771 commit 666aae9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

t/lib-httpd/apache.conf

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,20 @@ ErrorLog error.log
4545
Alias /dumb/ www/
4646
Alias /auth/dumb/ www/auth/dumb/
4747

48-
<Location /smart/>
48+
<LocationMatch /smart/>
4949
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
5050
SetEnv GIT_HTTP_EXPORT_ALL
51-
</Location>
52-
<Location /smart_noexport/>
51+
</LocationMatch>
52+
<LocationMatch /smart_noexport/>
5353
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
54-
</Location>
55-
<Location /smart_custom_env/>
54+
</LocationMatch>
55+
<LocationMatch /smart_custom_env/>
5656
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
5757
SetEnv GIT_HTTP_EXPORT_ALL
5858
SetEnv GIT_COMMITTER_NAME "Custom User"
5959
SetEnv GIT_COMMITTER_EMAIL [email protected]
60-
</Location>
61-
ScriptAlias /smart/ ${GIT_EXEC_PATH}/git-http-backend/
62-
ScriptAlias /smart_noexport/ ${GIT_EXEC_PATH}/git-http-backend/
63-
ScriptAlias /smart_custom_env/ ${GIT_EXEC_PATH}/git-http-backend/
60+
</LocationMatch>
61+
ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1
6462
<Directory ${GIT_EXEC_PATH}>
6563
Options None
6664
</Directory>

0 commit comments

Comments
 (0)