From 7e08191a069c361f20b26eb515d112b8f7ad0998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sun, 11 Sep 2011 14:51:27 +0200 Subject: [PATCH] http: also store Content-Type if it's the last field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/transport-http.c | 6 ++++++ 1 file changed, 6 insertions(+) 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))