Merge commit '631936361405d812f353b4108246c883cdf48100' into Kingdread/issue-2304

This commit is contained in:
Florian Bruhin 2017-03-22 22:50:28 +01:00
commit 042ffeca91
4 changed files with 22 additions and 0 deletions

View File

@ -110,6 +110,9 @@ class DownloadItem(downloads.AbstractDownloadItem):
def _do_die(self):
"""Abort the download and emit an error."""
self._read_timer.stop()
if self._reply is None:
log.downloads.debug("Reply gone while dying")
return
self._reply.downloadProgress.disconnect()
self._reply.finished.disconnect()
self._reply.error.disconnect()

View File

@ -611,3 +611,9 @@ Feature: Downloading things from a website.
And I run :follow-hint 0
And I wait until the download is finished
Then the downloaded file user-agent should contain Safari/
@qtwebengine_skip: Handled by QtWebEngine, not by us
Scenario: Downloading a "Internal server error" with disposition: inline (#2304)
When I set storage -> prompt-download-directory to false
And I open custom/500-inline
Then the error "Download error: *INTERNAL SERVER ERROR" should be shown

View File

@ -74,6 +74,8 @@ class Request(testprocess.Line):
'/redirect-to': [http.client.FOUND],
'/cookies/set': [http.client.FOUND],
'/custom/500-inline': [http.client.INTERNAL_SERVER_ERROR],
}
for i in range(15):
path_to_statuses['/redirect/{}'.format(i)] = [http.client.FOUND]

View File

@ -122,6 +122,17 @@ def redirect_self():
return app.make_response(flask.redirect(flask.url_for('redirect_self')))
@app.route('/custom/500-inline')
def internal_error_attachment():
"""A 500 error with Content-Disposition: inline."""
response = flask.Response(b"", headers={
"Content-Type": "application/octet-stream",
"Content-Disposition": 'inline; filename="attachment.jpg"',
})
response.status_code = 500
return response
@app.after_request
def log_request(response):
"""Log a webserver request."""