summaryrefslogtreecommitdiff
path: root/src/transports
diff options
context:
space:
mode:
Diffstat (limited to 'src/transports')
-rw-r--r--src/transports/winhttp.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index 95c9d10bb..702243513 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -266,24 +266,18 @@ static int winhttp_stream_connect(winhttp_stream *s)
}
if (post_verb == s->verb) {
- /* Send Content-Type header -- only necessary on a POST */
+ /* Send Content-Type and Accept headers -- only necessary on a POST */
git_buf_clear(&buf);
- if (git_buf_printf(&buf, "Content-Type: application/x-git-%s-request", s->service) < 0)
+ if (git_buf_printf(&buf,
+ "Content-Type: application/x-git-%s-request\r\n"
+ "Accept: application/x-git-%s-result\r\n",
+ 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)) {
- giterr_set(GITERR_OS, "Failed to add a header to the request");
- goto on_error;
- }
-
- /* Set the Accept header */
- git_buf_clear(&buf);
- if (git_buf_printf(&buf, "Accept: application/x-git-%s-result\r\n", 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_REPLACE)) {
+ 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;
}