]> Cypherpunks repositories - gostls13.git/commitdiff
compress/gzip: clarify Latin-1 restrictions on gzip.Header
authorMatthew Dempsky <mdempsky@google.com>
Thu, 27 Aug 2015 16:56:26 +0000 (09:56 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 28 Aug 2015 22:05:53 +0000 (22:05 +0000)
Fixes #12361.

Change-Id: Ifd62e8d93b2d733e67e0186c7185cd6291d3bbc1
Reviewed-on: https://go-review.googlesource.com/13939
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/compress/gzip/gunzip.go
src/compress/gzip/gzip.go

index 72ee55c4fabdf5a310688bd7fda031c389510e1c..dc276535d3fa9f499f42909fb03ddb9f8616c6b1 100644 (file)
@@ -43,6 +43,9 @@ var (
 
 // The gzip file stores a header giving metadata about the compressed file.
 // That header is exposed as the fields of the Writer and Reader structs.
+//
+// Strings must be UTF-8 encoded and may only contain Unicode code points
+// U+0001 through U+00FF, due to limitations of the GZIP file format.
 type Header struct {
        Comment string    // comment
        Extra   []byte    // "extra data"
index 5131d128e4e21e348e975d4180b0207878a164dc..8c76144a0cc221b772f37d5b25b211492436f923 100644 (file)
@@ -44,10 +44,7 @@ type Writer struct {
 // Writes may be buffered and not flushed until Close.
 //
 // Callers that wish to set the fields in Writer.Header must do so before
-// the first call to Write or Close. The Comment and Name header fields are
-// UTF-8 strings in Go, but the underlying format requires NUL-terminated ISO
-// 8859-1 (Latin-1). NUL or non-Latin-1 runes in those strings will lead to an
-// error on Write.
+// the first call to Write, Flush, or Close.
 func NewWriter(w io.Writer) *Writer {
        z, _ := NewWriterLevel(w, DefaultCompression)
        return z