mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 21:53:48 +03:00
rewrite: Avoid panic on bad arg count for uri
(#6571)
This commit is contained in:
parent
2d12fb7ac6
commit
21f9c20a04
1 changed files with 2 additions and 2 deletions
|
@ -106,7 +106,7 @@ func parseCaddyfileURI(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, err
|
||||||
|
|
||||||
switch args[0] {
|
switch args[0] {
|
||||||
case "strip_prefix":
|
case "strip_prefix":
|
||||||
if len(args) > 2 {
|
if len(args) != 2 {
|
||||||
return nil, h.ArgErr()
|
return nil, h.ArgErr()
|
||||||
}
|
}
|
||||||
rewr.StripPathPrefix = args[1]
|
rewr.StripPathPrefix = args[1]
|
||||||
|
@ -115,7 +115,7 @@ func parseCaddyfileURI(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, err
|
||||||
}
|
}
|
||||||
|
|
||||||
case "strip_suffix":
|
case "strip_suffix":
|
||||||
if len(args) > 2 {
|
if len(args) != 2 {
|
||||||
return nil, h.ArgErr()
|
return nil, h.ArgErr()
|
||||||
}
|
}
|
||||||
rewr.StripPathSuffix = args[1]
|
rewr.StripPathSuffix = args[1]
|
||||||
|
|
Loading…
Reference in a new issue