hashmap: improve struct hashmap member documentation
[gitweb.git] / http.c
diff --git a/http.c b/http.c
index 84463dff3dc3c350abdc1cc1335a5fdddff5a1fe..3a28b219be5ecb270a6ff0422c7a4a5cdda023f0 100644 (file)
--- a/http.c
+++ b/http.c
@@ -927,7 +927,7 @@ static int extract_param(const char *raw, const char *name,
                return -1;
        raw++;
 
-       while (*raw && !isspace(*raw))
+       while (*raw && !isspace(*raw) && *raw != ';')
                strbuf_addch(out, *raw++);
        return 0;
 }
@@ -971,13 +971,16 @@ static void extract_content_type(struct strbuf *raw, struct strbuf *type,
 
        strbuf_reset(charset);
        while (*p) {
-               while (isspace(*p))
+               while (isspace(*p) || *p == ';')
                        p++;
                if (!extract_param(p, "charset", charset))
                        return;
                while (*p && !isspace(*p))
                        p++;
        }
+
+       if (!charset->len && starts_with(type->buf, "text/"))
+               strbuf_addstr(charset, "ISO-8859-1");
 }
 
 /* http_request() targets */