mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-12 10:05:57 +00:00
Add more headers to HTTP requests
This commit is contained in:
parent
1cef6b9f19
commit
c3733e5641
@ -54,6 +54,7 @@ typedef struct {
|
|||||||
char *redirect_url;
|
char *redirect_url;
|
||||||
const char *verb;
|
const char *verb;
|
||||||
char *chunk_buffer;
|
char *chunk_buffer;
|
||||||
|
git_strarray *extra_headers;
|
||||||
unsigned chunk_buffer_len;
|
unsigned chunk_buffer_len;
|
||||||
unsigned sent_request : 1,
|
unsigned sent_request : 1,
|
||||||
received_response : 1,
|
received_response : 1,
|
||||||
@ -193,6 +194,7 @@ static int gen_request(
|
|||||||
{
|
{
|
||||||
http_subtransport *t = OWNING_SUBTRANSPORT(s);
|
http_subtransport *t = OWNING_SUBTRANSPORT(s);
|
||||||
const char *path = t->connection_data.path ? t->connection_data.path : "/";
|
const char *path = t->connection_data.path ? t->connection_data.path : "/";
|
||||||
|
size_t i;
|
||||||
|
|
||||||
git_buf_printf(buf, "%s %s%s HTTP/1.1\r\n", s->verb, path, s->service_url);
|
git_buf_printf(buf, "%s %s%s HTTP/1.1\r\n", s->verb, path, s->service_url);
|
||||||
|
|
||||||
@ -210,6 +212,13 @@ static int gen_request(
|
|||||||
} else
|
} else
|
||||||
git_buf_puts(buf, "Accept: */*\r\n");
|
git_buf_puts(buf, "Accept: */*\r\n");
|
||||||
|
|
||||||
|
if (s->extra_headers) {
|
||||||
|
for (i = 0; i < s->extra_headers->count; i++) {
|
||||||
|
git_buf_puts(buf, s->extra_headers->strings[i]);
|
||||||
|
git_buf_puts(buf, "\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Apply credentials to the request */
|
/* Apply credentials to the request */
|
||||||
if (apply_credentials(buf, t) < 0)
|
if (apply_credentials(buf, t) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user