Bug 155058 - Fix file mime-types when using NetworkSession
Summary: Fix file mime-types when using NetworkSession
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
Depends on:
Reported: 2016-03-04 17:34 PST by Alex Christensen
Modified: 2016-03-05 12:15 PST (History)
1 user (show)

See Also:

Patch (4.48 KB, patch)
2016-03-04 17:39 PST, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2016-03-04 17:34:19 PST
Fix file mime-types when using NetworkSession
Comment 1 Alex Christensen 2016-03-04 17:39:10 PST
Created attachment 273062 [details]
Comment 2 WebKit Commit Bot 2016-03-04 19:30:12 PST
Comment on attachment 273062 [details]

Clearing flags on attachment: 273062

Committed r197606: <http://trac.webkit.org/changeset/197606>
Comment 3 WebKit Commit Bot 2016-03-04 19:30:16 PST
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2016-03-05 12:15:30 PST
Comment on attachment 273062 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=273062&action=review

> Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:100
> +    if (shouldContentSniff == WebCore::DoNotSniffContent || url.protocolIs("file")) {

At other call sites we use url.isLocalFile() rather than url.protocolIs("file"). I think we should do that here.

> Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm:174
> +        // Avoid MIME type sniffing if the response comes back as 304 Not Modified.
> +        int statusCode = [response respondsToSelector:@selector(statusCode)] ? [(id)response statusCode] : 0;
> +        if (statusCode != 304)
> +            WebCore::adjustMIMETypeIfNecessary(response._CFURLResponse);

Comment is unclear because “adjustMIMETypeIfNecessary” does not seem to be the same thing as “MIME type sniffing”. Maybe we should rename something or change the comment a bit?

Is 304 the *only* response where we don’t want to do sniffing? If so, why is it just that one?