mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 02:10:57 +00:00
no need lock here
This commit is contained in:
parent
973306b28d
commit
0afd04ec6f
@ -47,26 +47,20 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultSetting = BeegoHttpSettings{UserAgent: "beegoServer", ConnectTimeout: 60 * time.Second, ReadWriteTimeout: 60 * time.Second, Gzip: true}
|
var defaultSetting = BeegoHttpSettings{UserAgent: "beegoServer", ConnectTimeout: 60 * time.Second, ReadWriteTimeout: 60 * time.Second, Gzip: true}
|
||||||
var defaultCookieJar http.CookieJar
|
var defaultCookieJar http.CookieJar
|
||||||
var settingMutex sync.Mutex
|
|
||||||
|
|
||||||
// createDefaultCookie creates a global cookiejar to store cookies.
|
// createDefaultCookie creates a global cookiejar to store cookies.
|
||||||
func createDefaultCookie() {
|
func createDefaultCookie() {
|
||||||
settingMutex.Lock()
|
|
||||||
defaultCookieJar, _ = cookiejar.New(nil)
|
defaultCookieJar, _ = cookiejar.New(nil)
|
||||||
settingMutex.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overwrite default settings
|
// Overwrite default settings
|
||||||
func SetDefaultSetting(setting BeegoHttpSettings) {
|
func SetDefaultSetting(setting BeegoHttpSettings) {
|
||||||
settingMutex.Lock()
|
|
||||||
defaultSetting = setting
|
defaultSetting = setting
|
||||||
settingMutex.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return *BeegoHttpRequest with specific method
|
// return *BeegoHttpRequest with specific method
|
||||||
|
Loading…
Reference in New Issue
Block a user