@@ -24,7 +24,7 @@ import (
24
24
)
25
25
26
26
// Version of current package
27
- const Version = "1.9.0 "
27
+ const Version = "1.9.1 "
28
28
29
29
// Map is a shortcut for map[string]interface{}
30
30
type Map map [string ]interface {}
@@ -50,6 +50,14 @@ type Settings struct {
50
50
Immutable bool // default: false
51
51
// Max body size that the server accepts
52
52
BodyLimit int // default: 4 * 1024 * 1024
53
+ // Maximum number of concurrent connections.
54
+ Concurrency int // default: 256 * 1024
55
+ // Disable keep-alive connections, the server will close incoming connections after sending the first response to client
56
+ DisableKeepalive bool // default: false
57
+ // When set to true causes the default date header to be excluded from the response.
58
+ DisableDefaultDate bool // default: false
59
+ // When set to true, causes the default Content-Type header to be excluded from the Response.
60
+ DisableDefaultContentType bool // default: false
53
61
// Folder containing template files
54
62
TemplateFolder string // default: ""
55
63
// Template engine: html, amber, handlebars , mustache or pug
@@ -88,9 +96,12 @@ func New(settings ...*Settings) *App {
88
96
if ! app .Settings .Prefork { // Default to -prefork flag if false
89
97
app .Settings .Prefork = isPrefork ()
90
98
}
91
- if app .Settings .BodyLimit = = 0 { // Default MaxRequestBodySize
99
+ if app .Settings .BodyLimit < = 0 { // Default MaxRequestBodySize
92
100
app .Settings .BodyLimit = 4 * 1024 * 1024
93
101
}
102
+ if app .Settings .Concurrency <= 0 {
103
+ app .Settings .Concurrency = 256 * 1024
104
+ }
94
105
if app .Settings .Immutable { // Replace unsafe conversion funcs
95
106
getString = getStringImmutable
96
107
getBytes = getBytesImmutable
@@ -488,6 +499,10 @@ func (app *App) newServer() *fasthttp.Server {
488
499
return & fasthttp.Server {
489
500
Handler : app .handler ,
490
501
Name : app .Settings .ServerHeader ,
502
+ Concurrency : app .Settings .Concurrency ,
503
+ NoDefaultDate : app .Settings .DisableDefaultDate ,
504
+ NoDefaultContentType : app .Settings .DisableDefaultContentType ,
505
+ DisableKeepalive : app .Settings .DisableKeepalive ,
491
506
MaxRequestBodySize : app .Settings .BodyLimit ,
492
507
NoDefaultServerHeader : app .Settings .ServerHeader == "" ,
493
508
ReadTimeout : app .Settings .ReadTimeout ,
0 commit comments