mirror of
https://github.com/infinite-iroha/touka.git
synced 2026-02-03 00:41:10 +08:00
add maxBytesReader & ctxMerge
This commit is contained in:
parent
17bab2dcfd
commit
cb86cb935a
4 changed files with 270 additions and 8 deletions
17
engine.go
17
engine.go
|
|
@ -74,6 +74,9 @@ type Engine struct {
|
|||
// 如果设置了此回调,它将优先于 ServerConfigurator 被用于 HTTPS 服务器
|
||||
// 如果未设置,HTTPS 服务器将回退使用 ServerConfigurator (如果已设置)
|
||||
TLSServerConfigurator func(*http.Server)
|
||||
|
||||
// GlobalMaxRequestBodySize 全局请求体Body大小限制
|
||||
GlobalMaxRequestBodySize int64
|
||||
}
|
||||
|
||||
type ErrorHandle struct {
|
||||
|
|
@ -171,10 +174,11 @@ func New() *Engine {
|
|||
unMatchFS: UnMatchFS{
|
||||
ServeUnmatchedAsFS: false,
|
||||
},
|
||||
noRoute: nil,
|
||||
noRoutes: make(HandlersChain, 0),
|
||||
ServerConfigurator: nil,
|
||||
TLSServerConfigurator: nil,
|
||||
noRoute: nil,
|
||||
noRoutes: make(HandlersChain, 0),
|
||||
ServerConfigurator: nil,
|
||||
TLSServerConfigurator: nil,
|
||||
GlobalMaxRequestBodySize: -1,
|
||||
}
|
||||
//engine.SetProtocols(GetDefaultProtocolsConfig())
|
||||
engine.SetDefaultProtocols()
|
||||
|
|
@ -294,6 +298,11 @@ func (engine *Engine) SetProtocols(config *ProtocolsConfig) {
|
|||
engine.useDefaultProtocols = false
|
||||
}
|
||||
|
||||
// 配置全局Req Body大小限制
|
||||
func (engine *Engine) SetGlobalMaxRequestBodySize(size int64) {
|
||||
engine.GlobalMaxRequestBodySize = size
|
||||
}
|
||||
|
||||
// 配置Req IP来源 Headers
|
||||
func (engine *Engine) SetRemoteIPHeaders(headers []string) {
|
||||
engine.RemoteIPHeaders = headers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue