summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2020-01-06 04:18:59 +0300
committerdefanor <defanor@uberspace.net>2020-01-06 04:18:59 +0300
commit1d4d4951b0a29bec71f4485e9ed1ce1621329fe9 (patch)
tree7909ce144fd9be9ae4200cd96bf4de6f8b2db642
parente35ff9bcddd7819b5110cfeb9acf2e727063090e (diff)
downloadwwwlite-master.zip
wwwlite-master.tar.gz
wwwlite-master.tar.bz2
Check whether content type is defined at allHEADmaster
-rw-r--r--src/browserbox.c7
1 files changed, 5 insertions, 2 deletions
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;