]> Cypherpunks repositories - gostls13.git/commit
net/http: remove discrepancies between the MIME Sniffing Spec and its implementation
authorKshitij Saraogi <kshitijsaraogi@gmail.com>
Mon, 4 Mar 2019 10:59:25 +0000 (16:29 +0530)
committerEmmanuel Odeke <emm.odeke@gmail.com>
Wed, 6 Mar 2019 07:31:18 +0000 (07:31 +0000)
commit583fddf3bc85802869ce2d286fe8b32cc6728bc8
treeb7a15154eeadf6498f4fbcecdf6d9b972176e265
parent43e8fd4ef1ae24f1505bd34708fc30aa2b736c52
net/http: remove discrepancies between the MIME Sniffing Spec and its implementation

The change fixes the following deviations between the existing implementation and the Spec:
1. Using pattern instead of "mask" for assertion and iteration in the Pattern Matching Algorithm.
2. Rename "image/vnd.microsoft.icon" to "image/x-icon" and add another signature for the same.
3. Using named strings instead of hexadecimal representation in "application/zip" and "application/x-rar-compressed".
4. Reordering "sniffSignatures" in accordance with the Spec section "Identifying a resource with an unknown MIME type".

In addition to the above fixes, unit tests for Image MIME type group are added.

Fixes #30570

Change-Id: I97d2ae22b426c3c57bf8efd2ed9396c0be983688
Reviewed-on: https://go-review.googlesource.com/c/go/+/165277
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/net/http/sniff.go
src/net/http/sniff_test.go