summaryrefslogtreecommitdiff
path: root/transport.h
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2016-12-14 22:39:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-12-15 17:29:13 (GMT)
commita768a02265f3b8f43e37f66a0a3affba92c830c7 (patch)
tree332839901fe7f390b20c28ebfbbb1e329a987ce0 /transport.h
parentaeae4db1747d891dc3aee6a74508c585c321cc49 (diff)
downloadgit-a768a02265f3b8f43e37f66a0a3affba92c830c7.zip
git-a768a02265f3b8f43e37f66a0a3affba92c830c7.tar.gz
git-a768a02265f3b8f43e37f66a0a3affba92c830c7.tar.bz2
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 'transport.h')
-rw-r--r--transport.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/transport.h b/transport.h
index 3396e1d..4f1c801 100644
--- a/transport.h
+++ b/transport.h
@@ -142,10 +142,17 @@ struct transport {
struct transport *transport_get(struct remote *, const char *);
/*
- * Check whether a transport is allowed by the environment. Type should
- * generally be the URL scheme, as described in Documentation/git.txt
+ * Check whether a transport is allowed by the environment.
+ *
+ * Type should generally be the URL scheme, as described in
+ * Documentation/git.txt
+ *
+ * from_user specifies if the transport was given by the user. If unknown pass
+ * a -1 to read from the environment to determine if the transport was given by
+ * the user.
+ *
*/
-int is_transport_allowed(const char *type);
+int is_transport_allowed(const char *type, int from_user);
/*
* Check whether a transport is allowed by the environment,