12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
//
15
- // modified by HenryLee 2016.11.11
15
+ // modified by AndeyaLee 2016.11.11
16
16
17
17
package acceptencoder
18
18
@@ -29,13 +29,13 @@ import (
29
29
)
30
30
31
31
var (
32
- //Default size==20B same as nginx
32
+ // Default size==20B same as nginx
33
33
defaultGzipMinLength = 20
34
- //Content will only be compressed if content length is either unknown or greater than gzipMinLength.
34
+ // Content will only be compressed if content length is either unknown or greater than gzipMinLength.
35
35
gzipMinLength = defaultGzipMinLength
36
- //The compression level used for deflate compression. (0-9).
36
+ // The compression level used for deflate compression. (0-9).
37
37
gzipCompressLevel int
38
- //List of HTTP methods to compress. If not set, only GET requests are compressed.
38
+ // List of HTTP methods to compress. If not set, only GET requests are compressed.
39
39
includedMethods map [string ]bool
40
40
getMethodOnly bool
41
41
)
@@ -65,7 +65,7 @@ type nopResetWriter struct {
65
65
}
66
66
67
67
func (n nopResetWriter ) Reset (w io.Writer ) {
68
- //do nothing
68
+ // do nothing
69
69
}
70
70
71
71
type acceptEncoder struct {
@@ -98,9 +98,9 @@ func (ac acceptEncoder) put(wr resetWriter, level int) {
98
98
}
99
99
wr .Reset (nil )
100
100
101
- //notice
102
- //compressionLevel==BestCompression DOES NOT MATTER
103
- //sync.Pool will not memory leak
101
+ // notice
102
+ // compressionLevel==BestCompression DOES NOT MATTER
103
+ // sync.Pool will not memory leak
104
104
105
105
switch level {
106
106
case gzipCompressLevel :
@@ -119,10 +119,10 @@ var (
119
119
bestCompressionPool : & sync.Pool {New : func () interface {} { wr , _ := gzip .NewWriterLevel (nil , flate .BestCompression ); return wr }},
120
120
}
121
121
122
- //according to the sec :http://tools.ietf.org/html/rfc2616#section-3.5 ,the deflate compress in http is zlib indeed
123
- //deflate
124
- //The "zlib" format defined in RFC 1950 [31] in combination with
125
- //the "deflate" compression mechanism described in RFC 1951 [29].
122
+ // according to the sec :http://tools.ietf.org/html/rfc2616#section-3.5 ,the deflate compress in http is zlib indeed
123
+ // deflate
124
+ // The "zlib" format defined in RFC 1950 [31] in combination with
125
+ // the "deflate" compression mechanism described in RFC 1951 [29].
126
126
deflateCompressEncoder = acceptEncoder {
127
127
name : "deflate" ,
128
128
levelEncode : func (level int ) resetWriter { wr , _ := zlib .NewWriterLevel (nil , level ); return wr },
0 commit comments