You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/NIOHTTPCompression/HTTPDecompression.swift
+34-11Lines changed: 34 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -94,18 +94,41 @@ public enum NIOHTTPDecompression {
94
94
returnnil
95
95
}
96
96
}
97
-
98
-
varwindow:CInt{
99
-
switchself{
100
-
case.deflate:
101
-
return15
102
-
case.gzip:
103
-
return15+16
104
-
}
105
-
}
106
97
}
107
98
108
99
structDecompressor{
100
+
/// `15` is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library.
101
+
/// `32` enables automatic detection of gzip or zlib compression format with automatic header detection.
102
+
///
103
+
/// Documentation from https://www.zlib.net/manual.html:
104
+
/// The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer).
105
+
/// It should be in the range 8..15 for this version of the library.
106
+
/// The default value is 15 if inflateInit is used instead.
107
+
/// windowBits must be greater than or equal to the windowBits value provided to deflateInit2() while compressing,
108
+
/// or it must be equal to 15 if deflateInit2() was not used.
109
+
/// If a compressed stream with a larger window size is given as input,
110
+
/// inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window.
111
+
/// windowBits can also be zero to request that inflate use the window size in the zlib header of the compressed stream.
112
+
/// windowBits can also be –8..–15 for raw inflate.
113
+
/// In this case, -windowBits determines the window size.
114
+
/// inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value,
115
+
/// and not looking for any check values for comparison at the end of the stream.
116
+
/// This is for use with other formats that use the deflate compressed data format such as zip.
117
+
/// Those formats provide their own check values.
118
+
/// If a custom format is developed using the raw deflate format for compressed data,
119
+
/// it is recommended that a check value such as an Adler-32 or a CRC-32 be applied to the uncompressed data as is done in the zlib,
120
+
/// gzip, and zip formats. For most applications, the zlib format should be used as is.
121
+
/// Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits.
122
+
/// windowBits can also be greater than 15 for optional gzip decoding.
123
+
/// Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection,
124
+
/// or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR).
125
+
/// If a gzip stream is being decoded, strm->adler is a CRC-32 instead of an Adler-32.
126
+
/// Unlike the gunzip utility and gzread() (see below), inflate() will not automatically decode concatenated gzip members.
127
+
/// inflate() will return Z_STREAM_END at the end of the gzip member.
128
+
/// The state would need to be reset to continue decoding a subsequent gzip member.
129
+
/// This must be done if there is more data after a gzip member, in order for the decompression to be compliant with the gzip standard (RFC 1952).
0 commit comments