From 1d4d4951b0a29bec71f4485e9ed1ce1621329fe9 Mon Sep 17 00:00:00 2001 From: defanor Date: Mon, 6 Jan 2020 04:18:59 +0300 Subject: Check whether content type is defined at all --- src/browserbox.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/browserbox.c') diff --git a/src/browserbox.c b/src/browserbox.c index 595afb3..a4f1430 100644 --- a/src/browserbox.c +++ b/src/browserbox.c @@ -1313,8 +1313,11 @@ void got_headers(SoupMessage *msg, gpointer ptr) "response-headers", &smh, NULL); const char *ct = soup_message_headers_get_content_type(smh, NULL); - if (! (strcmp(ct, "text/html") == 0 || - strcmp(ct, "application/xhtml+xml") == 0)) { + if (ct == NULL) { + browser_box_set_status(bb, "Unknown content type"); + bb->builder_state->active = FALSE; + } else if (! (strcmp(ct, "text/html") == 0 || + strcmp(ct, "application/xhtml+xml") == 0)) { browser_box_set_status(bb, "Unsupported content type"); /* todo: offer to download a file */ bb->builder_state->active = FALSE; -- cgit v1.2.3