summaryrefslogtreecommitdiff
path: root/src/stream.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-06-07 14:42:13 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-06-24 17:26:36 +0200
commit1376e784c63bc63492a9ba04d5e1f07654deba60 (patch)
treed0ceb3e6a60f4c47fe6bab32a373e9b5b813fc87 /src/stream.h
parentede517bc5322022850854f22906be934736b4f57 (diff)
downloadlibgit2-1376e784c63bc63492a9ba04d5e1f07654deba60.tar.gz
stream: add support for setting a proxy
If the stream claims to support this feature, we can let the transport set the proxy. We also set HTTPPROXYTUNNEL option so curl can create a tunnel through the proxy which lets us create our own TLS session (if needed).
Diffstat (limited to 'src/stream.h')
-rw-r--r--src/stream.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/stream.h b/src/stream.h
index d810e704d..43fcc3045 100644
--- a/src/stream.h
+++ b/src/stream.h
@@ -30,6 +30,21 @@ GIT_INLINE(int) git_stream_certificate(git_cert **out, git_stream *st)
return st->certificate(out, st);
}
+GIT_INLINE(int) git_stream_supports_proxy(git_stream *st)
+{
+ return st->proxy_support;
+}
+
+GIT_INLINE(int) git_stream_set_proxy(git_stream *st, const char *proxy_url)
+{
+ if (!st->proxy_support) {
+ giterr_set(GITERR_INVALID, "proxy not supported on this stream");
+ return -1;
+ }
+
+ return st->set_proxy(st, proxy_url);
+}
+
GIT_INLINE(ssize_t) git_stream_read(git_stream *st, void *data, size_t len)
{
return st->read(st, data, len);