summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-09-11 14:51:27 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-09-12 17:04:17 +0200
commit7e08191a069c361f20b26eb515d112b8f7ad0998 (patch)
tree029be47664184b65ec07364b4b6f165f0dc09849
parent5604f92880333fdc8a2d0eeeaa873ea76b7ed53b (diff)
downloadlibgit2-7e08191a069c361f20b26eb515d112b8f7ad0998.tar.gz
http: also store Content-Type if it's the last field
When Content-Type is the last field, we only know when we can store it when we reach on_headers_complete. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
-rw-r--r--src/transport-http.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/transport-http.c b/src/transport-http.c
index a69cb373a..3feee006f 100644
--- a/src/transport-http.c
+++ b/src/transport-http.c
@@ -181,6 +181,12 @@ static int on_headers_complete(http_parser *parser)
transport_http *t = (transport_http *) parser->data;
git_buf *buf = &t->buf;
+ if (t->content_type == NULL) {
+ t->content_type = git__strdup(git_buf_cstr(buf));
+ if (t->content_type == NULL)
+ return t->error = GIT_ENOMEM;
+ }
+
git_buf_clear(buf);
git_buf_printf(buf, "application/x-git-%s-advertisement", t->service);
if (git_buf_oom(buf))