mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-10 03:56:58 +00:00
Use two calls to set two headers
This commit is contained in:
parent
fd5d80d25a
commit
df9fc82e97
@ -269,9 +269,22 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|||||||
/* Send Content-Type and Accept headers -- only necessary on a POST */
|
/* Send Content-Type and Accept headers -- only necessary on a POST */
|
||||||
git_buf_clear(&buf);
|
git_buf_clear(&buf);
|
||||||
if (git_buf_printf(&buf,
|
if (git_buf_printf(&buf,
|
||||||
"Content-Type: application/x-git-%s-request\r\n"
|
"Content-Type: application/x-git-%s-request",
|
||||||
"Accept: application/x-git-%s-result\r\n",
|
s->service) < 0)
|
||||||
s->service, s->service) < 0)
|
goto on_error;
|
||||||
|
|
||||||
|
git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf));
|
||||||
|
|
||||||
|
if (!WinHttpAddRequestHeaders(s->request, ct, (ULONG)-1L,
|
||||||
|
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE)) {
|
||||||
|
giterr_set(GITERR_OS, "Failed to add a header to the request");
|
||||||
|
goto on_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
git_buf_clear(&buf);
|
||||||
|
if (git_buf_printf(&buf,
|
||||||
|
"Accept: application/x-git-%s-result",
|
||||||
|
s->service) < 0)
|
||||||
goto on_error;
|
goto on_error;
|
||||||
|
|
||||||
git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf));
|
git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf));
|
||||||
|
Loading…
Reference in New Issue
Block a user