Commit ff830366ea611c9285a23432edebc16ff6a3d436

Philip Kelley 2012-11-01T12:07:42

Http: Set an error for invalid content-type

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/transports/http.c b/src/transports/http.c
index 1d0bbd6..f33cad7 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -170,8 +170,10 @@ static int on_headers_complete(http_parser *parser)
 	if (git_buf_oom(buf))
 		return t->parse_error = -1;
 
-	if (strcmp(t->content_type, git_buf_cstr(buf)))
+	if (strcmp(t->content_type, git_buf_cstr(buf))) {
+		giterr_set(GITERR_NET, "Invalid content-type: %s", t->content_type);
 		return t->parse_error = -1;
+	}
 
 	git_buf_clear(buf);
 	return 0;