From: Daniel Carl Date: Fri, 29 Aug 2014 21:00:47 +0000 (+0200) Subject: Fixed download with content-range header (#101). X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=7fc2eb2fcc1b90f36e1bd76f80e0fd3b610b3587;p=vimb.git Fixed download with content-range header (#101). 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. --- diff --git a/src/main.c b/src/main.c index 46932dc..bab1570 100644 --- a/src/main.c +++ b/src/main.c @@ -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; }