Hook up the custom_headers to the http transport
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
diff --git a/src/transports/http.c b/src/transports/http.c
index d348310..764c6a9 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 31a2dec..15f45e1 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 4c728c7..2c87e02 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;