summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/reverseproxy')
-rw-r--r--modules/caddyhttp/reverseproxy/addresses.go6
-rw-r--r--modules/caddyhttp/reverseproxy/fastcgi/client.go8
2 files changed, 7 insertions, 7 deletions
diff --git a/modules/caddyhttp/reverseproxy/addresses.go b/modules/caddyhttp/reverseproxy/addresses.go
index f15ed76..c161ed8 100644
--- a/modules/caddyhttp/reverseproxy/addresses.go
+++ b/modules/caddyhttp/reverseproxy/addresses.go
@@ -80,9 +80,9 @@ func parseUpstreamDialAddress(upstreamAddr string) (string, string, error) {
scheme, host, port = toURL.Scheme, toURL.Hostname(), toURL.Port()
} else {
// extract network manually, since caddy.ParseNetworkAddress() will always add one
- if idx := strings.Index(upstreamAddr, "/"); idx >= 0 {
- network = strings.ToLower(strings.TrimSpace(upstreamAddr[:idx]))
- upstreamAddr = upstreamAddr[idx+1:]
+ if beforeSlash, afterSlash, slashFound := strings.Cut(upstreamAddr, "/"); slashFound {
+ network = strings.ToLower(strings.TrimSpace(beforeSlash))
+ upstreamAddr = afterSlash
}
var err error
host, port, err = net.SplitHostPort(upstreamAddr)
diff --git a/modules/caddyhttp/reverseproxy/fastcgi/client.go b/modules/caddyhttp/reverseproxy/fastcgi/client.go
index 0772053..0fdcbfe 100644
--- a/modules/caddyhttp/reverseproxy/fastcgi/client.go
+++ b/modules/caddyhttp/reverseproxy/fastcgi/client.go
@@ -424,13 +424,13 @@ func (c *FCGIClient) Request(p map[string]string, req io.Reader) (resp *http.Res
resp.Header = http.Header(mimeHeader)
if resp.Header.Get("Status") != "" {
- statusParts := strings.SplitN(resp.Header.Get("Status"), " ", 2)
- resp.StatusCode, err = strconv.Atoi(statusParts[0])
+ statusNumber, statusInfo, statusIsCut := strings.Cut(resp.Header.Get("Status"), " ")
+ resp.StatusCode, err = strconv.Atoi(statusNumber)
if err != nil {
return
}
- if len(statusParts) > 1 {
- resp.Status = statusParts[1]
+ if statusIsCut {
+ resp.Status = statusInfo
}
} else {