]> git.ipfire.org Git - thirdparty/git.git/commit - transport.c
transport: add from_user parameter to is_transport_allowed
authorBrandon Williams <bmwill@google.com>
Wed, 14 Dec 2016 22:39:54 +0000 (14:39 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Dec 2016 17:29:13 +0000 (09:29 -0800)
commita768a02265f3b8f43e37f66a0a3affba92c830c7
tree332839901fe7f390b20c28ebfbbb1e329a987ce0
parentaeae4db1747d891dc3aee6a74508c585c321cc49
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>
http.c
t/t5812-proto-disable-http.sh
transport.c
transport.h