mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
embed: Added a check for an nil value of the request in ServeHTTP method. Fixed #12821
This commit is contained in:
parent
aeb9b5fc73
commit
c3303d94a4
@ -303,8 +303,12 @@ type accessController struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ac *accessController) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
func (ac *accessController) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||||
|
if req == nil {
|
||||||
|
http.Error(rw, "Request is nil", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
// redirect for backward compatibilities
|
// redirect for backward compatibilities
|
||||||
if req != nil && req.URL != nil && strings.HasPrefix(req.URL.Path, "/v3beta/") {
|
if req.URL != nil && strings.HasPrefix(req.URL.Path, "/v3beta/") {
|
||||||
req.URL.Path = strings.Replace(req.URL.Path, "/v3beta/", "/v3/", 1)
|
req.URL.Path = strings.Replace(req.URL.Path, "/v3beta/", "/v3/", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user