mirror of
https://git.proxmox.com/git/libgit2
synced 2026-01-08 17:41:41 +00:00
http: set the proxy if the stream supports it
Of the built-in ones, only cURL support it, but there's no reason a user-provided stream wouldn't support it.
This commit is contained in:
parent
1376e784c6
commit
8762d721f4
@ -10,6 +10,7 @@
|
||||
#include "http_parser.h"
|
||||
#include "buffer.h"
|
||||
#include "netops.h"
|
||||
#include "remote.h"
|
||||
#include "smart.h"
|
||||
#include "auth.h"
|
||||
#include "auth_negotiate.h"
|
||||
@ -533,6 +534,7 @@ static int write_chunk(git_stream *io, const char *buffer, size_t len)
|
||||
static int http_connect(http_subtransport *t)
|
||||
{
|
||||
int error;
|
||||
char *proxy_url;
|
||||
|
||||
if (t->connected &&
|
||||
http_should_keep_alive(&t->parser) &&
|
||||
@ -560,6 +562,15 @@ static int http_connect(http_subtransport *t)
|
||||
|
||||
GITERR_CHECK_VERSION(t->io, GIT_STREAM_VERSION, "git_stream");
|
||||
|
||||
if (git_stream_supports_proxy(t->io) &&
|
||||
!git_remote__get_http_proxy(t->owner->owner, !!t->connection_data.use_ssl, &proxy_url)) {
|
||||
error = git_stream_set_proxy(t->io, proxy_url);
|
||||
git__free(proxy_url);
|
||||
|
||||
if (error < 0)
|
||||
return error;
|
||||
}
|
||||
|
||||
error = git_stream_connect(t->io);
|
||||
|
||||
#if defined(GIT_OPENSSL) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CURL)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user