diff options
author | Brandon Williams <bmwill@google.com> | 2016-12-14 23:39:54 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-15 18:29:13 +0100 |
commit | a768a02265f3b8f43e37f66a0a3affba92c830c7 (patch) | |
tree | 332839901fe7f390b20c28ebfbbb1e329a987ce0 /t/t5812-proto-disable-http.sh | |
parent | http: create function to get curl allowed protocols (diff) | |
download | git-a768a02265f3b8f43e37f66a0a3affba92c830c7.tar.xz git-a768a02265f3b8f43e37f66a0a3affba92c830c7.zip |
transport: add from_user parameter to is_transport_allowed
Add a from_user parameter to is_transport_allowed() to allow http to be
able to distinguish between protocol restrictions for redirects versus
initial requests. CURLOPT_REDIR_PROTOCOLS can now be set differently
from CURLOPT_PROTOCOLS to disallow use of protocols with the "user"
policy in redirects.
This change allows callers to query if a transport protocol is allowed,
given that the caller knows that the protocol is coming from the user
(1) or not from the user (0) such as redirects in libcurl. If unknown a
-1 should be provided which falls back to reading
`GIT_PROTOCOL_FROM_USER` to determine if the protocol came from the
user.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5812-proto-disable-http.sh')
-rwxr-xr-x | t/t5812-proto-disable-http.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t5812-proto-disable-http.sh b/t/t5812-proto-disable-http.sh index 044cc152f8..d911afd24c 100755 --- a/t/t5812-proto-disable-http.sh +++ b/t/t5812-proto-disable-http.sh @@ -30,5 +30,12 @@ test_expect_success 'curl limits redirects' ' test_must_fail git clone "$HTTPD_URL/loop-redir/smart/repo.git" ' +test_expect_success 'http can be limited to from-user' ' + git -c protocol.http.allow=user \ + clone "$HTTPD_URL/smart/repo.git" plain.git && + test_must_fail git -c protocol.http.allow=user \ + clone "$HTTPD_URL/smart-redir-perm/repo.git" redir.git +' + stop_httpd test_done |