-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.go
25 lines (21 loc) · 929 Bytes
/
settings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright 2013 Liviu G. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package goscgi
import "time"
type Settings struct {
MaxHeaderSize int
MaxContentSize int64
ListenTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
}
func NewSettings() *Settings {
return &Settings{
42 * 1024, // MaxHeaderSize 42 KB = (max 4KB/cookie) * (max 10 cookies) + 2KB headers
4 * 1024 * 1024, // MaxContentSize 4 MB = the max req.ContentSize accepted; anything over -> bad request
3 * time.Second, // ListenTimeout = the max duration listener.Accept() stays blocked waiting for a connection
5 * time.Second, // ReadTimeout 5sec * 1MB/sec -> we can receive max 5MB on a 1MB downlink before timeout ?
5 * time.Second, // WriteTimeout 5sec * 1MB/sec -> we can deliver max 5MB on a 1MB uplink before timeout ?
}
}