diff options
author | Ben Straub <bs@github.com> | 2013-10-08 13:40:52 -0700 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-10-08 13:40:52 -0700 |
commit | a58eecd436ff9344cda18efcdfa1da034503512e (patch) | |
tree | 49b7d19ecd050f5ebaf334a840e7ba4714eb38f5 | |
parent | ca27ae4859e86006d4b7d2fda4976f328f4726cb (diff) | |
download | libgit2-a58eecd436ff9344cda18efcdfa1da034503512e.tar.gz |
WinHTTP: set Accept header for POSTs
-rw-r--r-- | src/transports/winhttp.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c index 067d6fcc3..95c9d10bb 100644 --- a/src/transports/winhttp.c +++ b/src/transports/winhttp.c @@ -265,8 +265,8 @@ 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 header -- only necessary on a POST */ git_buf_clear(&buf); if (git_buf_printf(&buf, "Content-Type: application/x-git-%s-request", s->service) < 0) goto on_error; @@ -277,6 +277,16 @@ static int winhttp_stream_connect(winhttp_stream *s) 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)) { + giterr_set(GITERR_OS, "Failed to add a header to the request"); + goto on_error; + } } /* If requested, disable certificate validation */ |