aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/callbacks.c
diff options
context:
space:
mode:
authorGravatar koral <koral@mailoo.org>2011-02-02 16:29:46 +0100
committerGravatar koral <koral@mailoo.org>2011-02-02 16:29:46 +0100
commitf9920be8b0a74af775e20ef83f76fab7662ee120 (patch)
tree137a4ae47ffd63ac32d5c165465f6092e1f43927 /src/callbacks.c
parent7fbebb427be655ee17de0b786e0ce9a3d86ea3d8 (diff)
parent835f5d8d09b429a4776192dbe00be5ae20704b16 (diff)
Merge branch 'experimental' of https://github.com/Dieterbe/uzbl into cleaning-commenting
Diffstat (limited to 'src/callbacks.c')
-rw-r--r--src/callbacks.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index f6fe284..b947c8e 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -831,16 +831,19 @@ download_cb(WebKitWebView *web_view, WebKitDownload *download, gpointer user_dat
g_object_get(download, "suggested-filename", &suggested_filename, NULL);
/* get the mimetype of the download */
- const gchar *content_type;
+ const gchar *content_type = NULL;
WebKitNetworkResponse *r = webkit_download_get_network_response(download);
/* downloads can be initiated from the context menu, in that case there is
no network response yet and trying to get one would crash. */
if(WEBKIT_IS_NETWORK_RESPONSE(r)) {
- SoupMessage *m = webkit_network_response_get_message(r);
- SoupMessageHeaders *h;
+ SoupMessage *m = webkit_network_response_get_message(r);
+ SoupMessageHeaders *h = NULL;
g_object_get(m, "response-headers", &h, NULL);
- content_type = soup_message_headers_get_one(h, "Content-Type");
- } else
+ if(h) /* some versions of libsoup don't have "response-headers" here */
+ content_type = soup_message_headers_get_one(h, "Content-Type");
+ }
+
+ if(!content_type)
content_type = "application/octet-stream";
/* get the filesize of the download, as given by the server.