diff options
| author | Vicent Martà <vicent@github.com> | 2013-10-08 16:32:06 -0700 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2013-10-08 16:32:06 -0700 |
| commit | 062c95c2a9265cab8039c02a978944cd672017e5 (patch) | |
| tree | 4d1caa79563ae2eefce5beb42f154f212274d4af /src | |
| parent | ca27ae4859e86006d4b7d2fda4976f328f4726cb (diff) | |
| parent | 3dc3c723dac9fd2550530675b61849f2215ef767 (diff) | |
| download | libgit2-062c95c2a9265cab8039c02a978944cd672017e5.tar.gz | |
Merge pull request #1895 from libgit2/winhttp-accept
WinHTTP: set Accept header for POSTs
Diffstat (limited to 'src')
| -rw-r--r-- | src/transports/winhttp.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c index 067d6fcc3..702243513 100644 --- a/src/transports/winhttp.c +++ b/src/transports/winhttp.c @@ -265,15 +265,19 @@ static int winhttp_stream_connect(winhttp_stream *s) goto on_error; } - /* Send Content-Type header -- only necessary on a POST */ if (post_verb == s->verb) { + /* 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)) { + 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; } |
