• Kshitij Saraogi's avatar
    net/http: remove discrepancies between the MIME Sniffing Spec and its implementation · 583fddf3
    Kshitij Saraogi authored
    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/+/165277Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
    Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    583fddf3
sniff_test.go 7.75 KB