mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Use map to check for long-running request
Signed-off-by: Ted Yu <yute@vmware.com>
This commit is contained in:
parent
16085784bc
commit
fe6e50df3d
@ -824,15 +824,17 @@ func trimURLPath(path string) string {
|
|||||||
return parts[0]
|
return parts[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var longRunningRequestPathMap = map[string]bool{
|
||||||
|
"exec": true,
|
||||||
|
"attach": true,
|
||||||
|
"portforward": true,
|
||||||
|
"debug": true,
|
||||||
|
}
|
||||||
|
|
||||||
// isLongRunningRequest determines whether the request is long-running or not.
|
// isLongRunningRequest determines whether the request is long-running or not.
|
||||||
func isLongRunningRequest(path string) bool {
|
func isLongRunningRequest(path string) bool {
|
||||||
longRunningRequestPaths := []string{"exec", "attach", "portforward", "debug"}
|
_, ok := longRunningRequestPathMap[path]
|
||||||
for _, p := range longRunningRequestPaths {
|
return ok
|
||||||
if p == path {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServeHTTP responds to HTTP requests on the Kubelet.
|
// ServeHTTP responds to HTTP requests on the Kubelet.
|
||||||
|
Loading…
Reference in New Issue
Block a user