1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 09:10:55 +00:00

Rlock for form query

This commit is contained in:
playHing 2020-07-13 23:11:23 +08:00
parent 55e6298f29
commit 3e2c795410

View File

@ -334,11 +334,13 @@ func (input *BeegoInput) Query(key string) string {
} }
if input.Context.Request.Form == nil { if input.Context.Request.Form == nil {
input.dataLock.Lock() input.dataLock.Lock()
defer input.dataLock.Unlock()
if input.Context.Request.Form == nil { if input.Context.Request.Form == nil {
input.Context.Request.ParseForm() input.Context.Request.ParseForm()
} }
input.dataLock.Unlock()
} }
input.dataLock.RLock()
defer input.dataLock.RUnlock()
return input.Context.Request.Form.Get(key) return input.Context.Request.Form.Get(key)
} }