Bug 168299

Summary: [SOUP] Ensure a response MIME type when Content-Type is missing and sniffing not allowed
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply
Priority: P2 Keywords: LayoutTestFailure, Soup
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch svillar: review+

Carlos Garcia Campos
Reported 2017-02-14 02:52:31 PST
Sniffing is not allowed but we can try to guess the MIME using the response path, or at least fallback to default MIME type instead of leaving an empty string. This will fix a couple of tests that expect application/octet-stream in this particular case.
Attachments
Patch (3.26 KB, patch)
2017-02-14 03:06 PST, Carlos Garcia Campos
svillar: review+
Carlos Garcia Campos
Comment 1 2017-02-14 03:06:16 PST
Sergio Villar Senin
Comment 2 2017-02-14 03:35:03 PST
Comment on attachment 301481 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=301481&action=review > Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp:334 > + } What about just adding if (m_response.mimeType().isEmpty() && m_soupMessage->status_code != SOUP_STATUS_NOT_MODIFIED) m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(m_response.url().path())); to the previous code? I prefer that option because it clearly shows that the call to updateFromSoupMessage is unconditional.
Carlos Garcia Campos
Comment 3 2017-02-14 03:47:09 PST
Comment on attachment 301481 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=301481&action=review >> Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp:334 >> + } > > What about just adding > > if (m_response.mimeType().isEmpty() && m_soupMessage->status_code != SOUP_STATUS_NOT_MODIFIED) > m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(m_response.url().path())); > > to the previous code? I prefer that option because it clearly shows that the call to updateFromSoupMessage is unconditional. Yes, I thought about that, and I didn't do it to avoid checking 304 twice, but it's not a big deal anyway. I'll update it before landing, thanks for the review.
Carlos Garcia Campos
Comment 4 2017-02-14 03:56:47 PST
Note You need to log in before you can comment on or make changes to this bug.