-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add context-based MIME sniffing #4183
Comments
We should add a |
Code: components/net_traits/lib.rs |
I can try to work on that. @jdm, do I understand correctly that the |
That looks fine for a first pass. We'll probably end up mapping those to the values for initiator, type, and destination in the fetch specification at some point, but let's focus on the MIME sniffing spec for now. |
I'll do that. Any suggestion how I can test it? |
Using a local web server and running Servo with |
A straightforward testcase to use will be loading a URL which has a non-text/html Content-Type header but returns HTML content. |
Testing in progress. Do you think it would be possible to put something in the testsuite? |
So, I configured Apache to associate mp4 to
where my file is actually html content. Servo renders it as html, regardless of |
Oh right, #7706 is about changing our HTML parser to actually care about the MIME type. If you use a type like |
How so? Won't Servo attempt to sniff it in a Browser context regardless of my patch? |
http://mxr.mozilla.org/servo/source/components/script/dom/servohtmlparser.rs#115 looks at the computed mime type and creates an image document if we think we have an image. If we sniff the response first and discover HTML content, the result should be a non-image document with sniffing enabled. |
I still don't follow. Unless I misunderstand the specs, by default, Servo will be in |
The version of the standard is not finalized at the time of this writing. Specifications may be found here: https://mimesniff.spec.whatwg.org/#context-specific-sniffing .
The version of the standard is not finalized at the time of this writing. Specifications may be found here: https://mimesniff.spec.whatwg.org/#context-specific-sniffing .
The version of the standard is not finalized at the time of this writing. Specifications may be found here: https://mimesniff.spec.whatwg.org/#context-specific-sniffing .
The version of the standard is not finalized at the time of this writing. Specifications may be found here: https://mimesniff.spec.whatwg.org/#context-specific-sniffing .
The version of the standard is not finalized at the time of this writing. Specifications may be found here: https://mimesniff.spec.whatwg.org/#context-specific-sniffing .
The version of the standard is not finalized at the time of this writing. Specifications may be found here: https://mimesniff.spec.whatwg.org/#context-specific-sniffing .
The version of the standard is not finalized at the time of this writing. Specifications may be found here: https://mimesniff.spec.whatwg.org/#context-specific-sniffing .
Implemementing context-based MIME type sniffing This is a rebase of #7842 that also adds a test. Fixes #4183. @Yoric, how's this look to you? <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8190) <!-- Reviewable:end -->
The version of the standard is not finalized at the time of this writing. Specifications may be found here: https://mimesniff.spec.whatwg.org/#context-specific-sniffing .
The version of the standard is not finalized at the time of this writing. Specifications may be found here: https://mimesniff.spec.whatwg.org/#context-specific-sniffing .
Implemementing context-based MIME type sniffing This is a rebase of #7842 that also adds a test. Fixes #4183. @Yoric, how's this look to you? <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8190) <!-- Reviewable:end -->
Implemementing context-based MIME type sniffing This is a rebase of #7842 that also adds a test. Fixes #4183. @Yoric, how's this look to you? <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8190) <!-- Reviewable:end -->
Follow on issue to #3144
Context based mime sniffing is described in https://mimesniff.spec.whatwg.org/#context-specific-sniffing. Certain types (such as fonts) can only be sniffed from a context. However, this will require more metadata to be handed to the sniffer task.
The text was updated successfully, but these errors were encountered: