mirror of
https://github.com/mailgun/groupcache.git
synced 2024-07-05 12:28:49 +00:00
Merge pull request #27 from EverythingMe/remove_extra_unescaping
removed extra url-unescaping in http pool
This commit is contained in:
commit
0ba15ac99c
14
http.go
14
http.go
|
@ -109,16 +109,8 @@ func (p *HTTPPool) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, "bad request", http.StatusBadRequest)
|
http.Error(w, "bad request", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
groupName, err := url.QueryUnescape(parts[0])
|
groupName := parts[0]
|
||||||
if err != nil {
|
key := parts[1]
|
||||||
http.Error(w, "decoding group: "+err.Error(), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
key, err := url.QueryUnescape(parts[1])
|
|
||||||
if err != nil {
|
|
||||||
http.Error(w, "decoding key: "+err.Error(), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch the value for this group/key.
|
// Fetch the value for this group/key.
|
||||||
group := GetGroup(groupName)
|
group := GetGroup(groupName)
|
||||||
|
@ -133,7 +125,7 @@ func (p *HTTPPool) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
group.Stats.ServerRequests.Add(1)
|
group.Stats.ServerRequests.Add(1)
|
||||||
var value []byte
|
var value []byte
|
||||||
err = group.Get(ctx, key, AllocatingByteSliceSink(&value))
|
err := group.Get(ctx, key, AllocatingByteSliceSink(&value))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user