Documentation
¶
Overview ¶
Package compress 提供一个支持内容压缩的中间件。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Funcs map[string]WriterFunc
Size int // 大于此值才会启用压缩
ErrorLog *log.Logger
// 仅对该表中的类型进行压缩
//
// 可以用通配符 * 作为结尾:
// text* 表示以 text 开头的 mimetype;
// 其它类型的值,表示完全匹配。
Types []string
// contains filtered or unexported fields
}
Options New 的参数
type WriterFunc ¶
type WriterFunc func(w io.Writer) (io.WriteCloser, error)
WriterFunc 定义了将一个 io.Writer 声明为具有压缩功能的 io.WriteCloser
Notes ¶
Bugs ¶
gzw.Close() 在执行时,可能会调用 w.Write() 进行输出, 而 w.Write() 又有可能隐性调用 w.WriteHeader() 输出报头。
所以如果在 c.h 中进行 panic,并让外层接收后作报头输出,可能会出错, 比如 issue9/web/internal/errors.Exit() 函数。
Click to show internal directories.
Click to hide internal directories.