summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/push
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/push')
-rw-r--r--modules/caddyhttp/push/link.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/caddyhttp/push/link.go b/modules/caddyhttp/push/link.go
index 16b0e7d..f7c1dd8 100644
--- a/modules/caddyhttp/push/link.go
+++ b/modules/caddyhttp/push/link.go
@@ -52,17 +52,16 @@ func parseLinkHeader(header string) []linkResource {
l.uri = strings.TrimSpace(link[li+1 : ri])
for _, param := range strings.Split(strings.TrimSpace(link[ri+1:]), semicolon) {
- parts := strings.SplitN(strings.TrimSpace(param), equal, 2)
- key := strings.TrimSpace(parts[0])
+ before, after, isCut := strings.Cut(strings.TrimSpace(param), equal)
+ key := strings.TrimSpace(before)
if key == "" {
continue
}
- if len(parts) == 1 {
+ if isCut {
+ l.params[key] = strings.TrimSpace(after)
+ } else {
l.params[key] = key
}
- if len(parts) == 2 {
- l.params[key] = strings.TrimSpace(parts[1])
- }
}
resources = append(resources, l)