[go] net: added tiff file type to sniffSignatures in sniff.go

66 views
Skip to first unread message

Casey Smith (Gerrit)

unread,
Oct 16, 2015, 5:39:26 PM10/16/15
to Ian Lance Taylor, golang-co...@googlegroups.com
Casey Smith uploaded a change:
https://go-review.googlesource.com/15990

net: added tiff file type to sniffSignatures in sniff.go

The current implementation of DetectContentType()
returns 'application/octet-stream' as the mime type for tiff images.
The byte signatures for tiff images have been added so the proper mime type
can be returned.

Change-Id: I2b0ab800f6f1d29d1db0df05d833ae140ad2a9d3
---
M src/net/http/sniff.go
1 file changed, 2 insertions(+), 0 deletions(-)



diff --git a/src/net/http/sniff.go b/src/net/http/sniff.go
index 3602969..c430b8f 100644
--- a/src/net/http/sniff.go
+++ b/src/net/http/sniff.go
@@ -84,6 +84,8 @@
&exactSig{[]byte("GIF89a"), "image/gif"},
&exactSig{[]byte("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A"), "image/png"},
&exactSig{[]byte("\xFF\xD8\xFF"), "image/jpeg"},
+ &exactSig{[]byte("\x49\x49\x2A\x00"), "image/tiff"},
+ &exactSig{[]byte("\x4D\x4D\x00\x2A"), "image/tiff"},
&exactSig{[]byte("BM"), "image/bmp"},
&maskedSig{
mask: []byte("\xFF\xFF\xFF\xFF\x00\x00\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF"),

--
https://go-review.googlesource.com/15990

Brad Fitzpatrick (Gerrit)

unread,
Oct 16, 2015, 6:07:23 PM10/16/15
to Casey Smith, Brad Fitzpatrick, golang-co...@googlegroups.com
Brad Fitzpatrick has posted comments on this change.

net: added tiff file type to sniffSignatures in sniff.go

Patch Set 1:

Sorry, this is an implementation of http://mimesniff.spec.whatwg.org/ and
not a generic MIME sniffer.

--
https://go-review.googlesource.com/15990
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-HasComments: No

Brad Fitzpatrick (Gerrit)

unread,
Oct 16, 2015, 6:32:10 PM10/16/15
to Casey Smith, David Symonds, Brad Fitzpatrick, golang-co...@googlegroups.com
Brad Fitzpatrick has posted comments on this change.

net: added tiff file type to sniffSignatures in sniff.go

Patch Set 1: Code-Review-1

Copying David to decide, but I'm pretty sure we don't want this.

You should just set the header yourself.

--
https://go-review.googlesource.com/15990
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: David Symonds <dsym...@golang.org>
Gerrit-HasComments: No

David Symonds (Gerrit)

unread,
Oct 16, 2015, 6:37:08 PM10/16/15
to Casey Smith, David Symonds, Brad Fitzpatrick, golang-co...@googlegroups.com
David Symonds has posted comments on this change.

net: added tiff file type to sniffSignatures in sniff.go

Patch Set 1: Code-Review-2

We've been pretty strict about only sniffing according to the WHATWG spec,
and I don't see TIFF in that spec.

Brad Fitzpatrick (Gerrit)

unread,
Oct 16, 2015, 7:25:38 PM10/16/15
to Casey Smith, David Symonds, Brad Fitzpatrick, golang-co...@googlegroups.com
Brad Fitzpatrick has abandoned this change.

Change subject: net: added tiff file type to sniffSignatures in sniff.go
......................................................................


Abandoned

Casey Smith (Gerrit)

unread,
Oct 17, 2015, 6:17:05 AM10/17/15
to Casey Smith, David Symonds, Brad Fitzpatrick, golang-co...@googlegroups.com
Casey Smith has posted comments on this change.

net: added tiff file type to sniffSignatures in sniff.go

Patch Set 1:

I see, that makes sense. Thanks for the explanation.

--
https://go-review.googlesource.com/15990
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Casey Smith <cas...@gmail.com>
Reply all
Reply to author
Forward
0 new messages