Closed Bug 1847659 Opened 1 year ago Closed 11 months ago

Use the new MimeType parser to parse content-types for response headers

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: twisniewski, Assigned: dotoole)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [necko-triaged][necko-priority-queue])

Attachments

(1 file)

We should be able to pass the mimesniff/mime-types/charset-parameter.window.html WPTs if we use our new MIMEType parser here:

We could also pass a lot of the other MimeSniff tests by using it for blob content types, but unfortunately those tests conflict with the File spec (because the File spec expects blobs to only be lowercased and rejected if they have non-ASCII characters, while the MimeSniffing spec seems to expect them to be normalized, as if parsed and then serialized).

Summary: Use the new MimeType parser to parse content-types → Use the new MimeType parser to parse content-types for response headers, and Request/Response fetch constructors
Summary: Use the new MimeType parser to parse content-types for response headers, and Request/Response fetch constructors → Use the new MimeType parser to parse content-types for response headers

https://searchfox.org/mozilla-central/rev/8b470bef89879d6c9248e183562f77fd8da9b926/netwerk/protocol/http/nsHttpResponseHead.cpp#634

net_ParseContentType(val, mContentType, mContentCharset, &dummy);

We need to do something like this:
https://searchfox.org/mozilla-central/rev/503938c13ef2dd174705dc0f6d0683ae43074ccc/netwerk/protocol/data/nsDataHandler.cpp#187-194

if (mozilla::UniquePtr<CMimeType> parsed = CMimeType::Parse(mimeType)) {
  parsed->GetFullType(aContentType);
  if (aContentCharset) {
    parsed->GetParameterValue(kCharset, *aContentCharset);
  }
  if (aMimeType) {
    parsed->Serialize(*aMimeType);
  }
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]
Assignee: nobody → dotoole

Note that I actually have a patch in the works here already, but there were still try-failures I haven't accounted for: https://treeherder.mozilla.org/jobs?repo=try&revision=356a369dc72bbecb6f0a525ad7c2dca464a33f27

Assignee: dotoole → nobody
Flags: needinfo?(dotoole)
Assignee: nobody → dotoole
Flags: needinfo?(dotoole)
Whiteboard: [necko-triaged] → [necko-triaged][necko-priority-queue]
Pushed by dotoole@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/433e82386c67 Use the new MimeType parser to parse content-types for response headers; r=kershaw,necko-reviewers
Blocks: 1871420
Flags: needinfo?(dotoole)
Pushed by dotoole@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8b4cc6e72a48 Use the new MimeType parser to parse content-types for response headers; r=kershaw,necko-reviewers
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
Duplicate of this bug: 1420575
Blocks: 1895075
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: