forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CrossSiteDocumentResourceHandler: network-independent mime type sniffing
Enhance the mime sniffers used by CrossSiteDocumentResourceHandler to expose an "maybe" result in addition to "yes" and "no". This indeterminate result, for example, would be returned if the first packet contained only "<". If that is followed by "html", it would sniff as HTML; if it were followed by "svg" it would not. In CrossSiteDocumentResourceHandler, if we don't have a definitive answer from the sniffers, keep buffering data until at least net::kMaxBytesToSniff bytes arrive. Additionally, don't sniff beyond net::kMaxBytesToSniff, even if more data is available -- this ensures determinism of the blocking logic, regardless of how the network delivers the stream. In CrossSiteDocumentResourceHandlerTest, modify the TestScenario so that the response body can arrive in multiple chunks, and include an expectation (|verdict_packet|) of which chunk will trigger the decision. Add TestScenarios to cover indeterminate sniffing cases, and empty-response cases. Bug: 795450 Change-Id: I5eaee2bb79c49db206264cc2255608152bd49a71 Reviewed-on: https://chromium-review.googlesource.com/825960 Commit-Queue: Charlie Reis <creis@chromium.org> Reviewed-by: Charlie Reis <creis@chromium.org> Cr-Commit-Position: refs/heads/master@{#524962}
- Loading branch information
1 parent
f403016
commit 4e4a85f
Showing
7 changed files
with
1,051 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.