Open Bug 1847659 Opened 10 months ago Updated 10 months ago

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

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

People

(Reporter: twisniewski, Assigned: dotoole)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

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)
You need to log in before you can comment on or make changes to this bug.