Commit 276f6aa0 by Matt Burke

Hook up the custom_headers to the http transport

parent 4f2b6093
......@@ -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]);
}
}
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment