diff options
author | Matt Burke <spraints@gmail.com> | 2015-09-08 14:00:37 -0400 |
---|---|---|
committer | Matt Burke <spraints@gmail.com> | 2015-09-08 14:02:47 -0400 |
commit | 276f6aa08d4cb35ad647b24bfa254b99af89e076 (patch) | |
tree | bf999854813f92d0ae6e55f4104fd44e75439bc8 | |
parent | 4f2b6093a64ead32f51a886186496821e003cee5 (diff) | |
download | libgit2-276f6aa08d4cb35ad647b24bfa254b99af89e076.tar.gz |
Hook up the custom_headers to the http transport
-rw-r--r-- | src/transports/http.c | 7 | ||||
-rw-r--r-- | src/transports/smart.c | 12 | ||||
-rw-r--r-- | src/transports/smart.h | 1 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/transports/http.c b/src/transports/http.c index d348310c1..764c6a97e 100644 --- a/src/transports/http.c +++ b/src/transports/http.c @@ -211,10 +211,9 @@ static int gen_request( } else git_buf_puts(buf, "Accept: */*\r\n"); - if (t->connection_data.extra_headers) { - for (i = 0; i < t->connection_data.extra_headers->count; i++) { - git_buf_puts(buf, t->connection_data.extra_headers->strings[i]); - git_buf_puts(buf, "\r\n"); + if (t->owner->custom_headers) { + for (i = 0; i < t->owner->custom_headers->count; i++) { + git_buf_printf(buf, "%s\r\n", t->owner->custom_headers->strings[i]); } } diff --git a/src/transports/smart.c b/src/transports/smart.c index 31a2dec7b..15f45e11c 100644 --- a/src/transports/smart.c +++ b/src/transports/smart.c @@ -66,6 +66,17 @@ static int git_smart__set_callbacks( return 0; } +static int git_smart__set_custom_headers( + git_transport *transport, + const git_strarray *custom_headers) +{ + transport_smart *t = (transport_smart *)transport; + + t->custom_headers = custom_headers; + + return 0; +} + int git_smart__update_heads(transport_smart *t, git_vector *symrefs) { size_t i; @@ -399,6 +410,7 @@ int git_transport_smart(git_transport **out, git_remote *owner, void *param) t->parent.version = GIT_TRANSPORT_VERSION; t->parent.set_callbacks = git_smart__set_callbacks; + t->parent.set_custom_headers = git_smart__set_custom_headers; t->parent.connect = git_smart__connect; t->parent.close = git_smart__close; t->parent.free = git_smart__free; diff --git a/src/transports/smart.h b/src/transports/smart.h index 4c728c7cc..2c87e0200 100644 --- a/src/transports/smart.h +++ b/src/transports/smart.h @@ -139,6 +139,7 @@ typedef struct { git_transport_message_cb error_cb; git_transport_certificate_check_cb certificate_check_cb; void *message_cb_payload; + const git_strarray *custom_headers; git_smart_subtransport *wrapped; git_smart_subtransport_stream *current_stream; transport_smart_caps caps; |