Fixed download with content-range header (#101).
authorDaniel Carl <danielcarl@gmx.de>
Fri, 29 Aug 2014 21:00:47 +0000 (23:00 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Fri, 29 Aug 2014 21:00:47 +0000 (23:00 +0200)
If the server responds with an Accept-Range header without content the
download was not started. In this case we got the status_code 0 which
indicates that libsoup has not sent the message.
Now we accept status_code 0 and the 2xx.

src/main.c

index 46932dc..bab1570 100644 (file)
@@ -1214,9 +1214,13 @@ static gboolean mimetype_decision_cb(WebKitWebView *webview,
         return false;
     }
 
-    /* don't start a download when the response has no 2xx status code */
+    /* Don't start a download when the response has no 2xx status code. Or the
+     * message was not sent before - this seems to be the case when the server
+     * responds with a Accept-Ranges header. */
     msg = webkit_network_request_get_message(request);
-    if (SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
+    if (SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)
+        || msg->status_code == SOUP_STATUS_NONE
+    ) {
         webkit_web_policy_decision_download(decision);
         return true;
     }