Re: [whatwg/fetch] investigate data: URL quoted parameters (#970)

IMO, the Fetch spec is wrong to silently alter `data:…` semantics specified by [RFC 2397](https://tools.ietf.org/html/rfc2397#section-3). That document did not encourage quoted-string media type parameter values, but it did not prohibit them either, instead deferring to [RFC 2396](https://tools.ietf.org/html/rfc2396#section-2.4.3) (which disallows `"` in _URIs_, as does [its replacement 3986](https://tools.ietf.org/html/rfc3986#section-3)). So there are no grounds for interpreting the body of `data:application/example;lang="foo,bar",baz` as `bar",baz`, although rejecting it at the _URL level_ for being invalid would make sense if not for the [tolerant behavior there](https://url.spec.whatwg.org/#validation-error) (e.g., `data:application/json,""` is already accepted). If at all possible (:crossed_fingers:), https://fetch.spec.whatwg.org/#data-url-processor step 5 should be changed to accommodate media type parameters with quoted-string values that contain commas.

As for round-tripping, «_parameter values should use the URL Escaped encoding instead of quoted string if the parameter values contain any "tspecial"_» anyway, so the canonical representation for my example would be `data:application/example;lang=foo%2Cbar,baz`. But proper treatment of that **also** requires changing https://fetch.spec.whatwg.org/#data-url-processor , specifically updating step 13 to be aware of percent-encoding in _mimeType_.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/970#issuecomment-557765782

Received on Saturday, 23 November 2019 04:25:59 UTC