-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly handling unsupported content #359
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,6 +208,21 @@ def test_invalid_wait(self): | |
'wait': wait}) | ||
self.assertStatusCode(r, 400) | ||
|
||
def test_unsupported_content(self): | ||
cases = [ | ||
# Short body (Can be received together with the headers) | ||
("raw-bytes?length=16", 200), | ||
# Short body with error | ||
("raw-bytes?length=16&claim_length=32&abort=1", 502), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this something webkit cannot handle? why? is it because of different content-length and actual length of response? Why do you need to abort() here? cant you just return this invalid response? I read in docs that
so perhaps also worth adding test for content-disposition? I also wonder about 502 status code, this is Bad Gateway so if there is some load balancer in front of splash, e.g. nginx, user may confuse 502 from splash with 502 from some load balancer. Is 502 best choice for status code? Are there any alternatives? |
||
# Long body (May not be received together with the headers) | ||
("raw-bytes?length=1000000", 200), | ||
# Long body with error | ||
("raw-bytes?length=100&claim_length=200&delayed_abort=1", 502), | ||
] | ||
for url, http_status in cases: | ||
r = self.request({"url": self.mockurl(url)}) | ||
self.assertStatusCode(r, http_status) | ||
|
||
@pytest.mark.skipif( | ||
not qt_551_plus(), | ||
reason="resource_timeout doesn't work in Qt5 < 5.5.1. See issue #269 for details." | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this attribute is set per browser tab and browser tab can be used to download multiple resources, if you set this attribute here will it affect other requests going through same webpage? e.g. script doing
other thing worth noting is that there could be multiple resources downloaded when rendering so e.g.
may issue 10 requests, first 6 will have supported content, but 7th will have unsupported content, what will happen with resources 7-10? will they be downloaded all right?
If only one among many resources is unsupported (e.g. there are many stylesheets and only one is corrupted) what response will user get?
In mockserver there is child resource called "subresources" you could probably add another similar test resource similar that would try to fetch one resource with unsupported content while rendering.