-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rfc): Merge multiple Cache-Control headers into one. (#439)
* fix(rfc): Merge multiple Cache-Control headers into one. * fix(ci): bump go to 1.21 and traefik issue with their yaegi interpreter stuck on 1.20 --------- Co-authored-by: Vincent Jordan <[email protected]> Co-authored-by: darkweak <[email protected]>
- Loading branch information
1 parent
6a3a385
commit 678a1db
Showing
43 changed files
with
378 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package rfc | ||
|
||
import ( | ||
"net/http" | ||
"strings" | ||
) | ||
|
||
// HeaderAllCommaSepValues returns all comma-separated values (each | ||
// with whitespace trimmed) for a given header name. According to | ||
// Section 4.2 of the HTTP/1.1 spec | ||
// (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2), | ||
// values from multiple occurrences of a header should be concatenated, if | ||
// the header's value is a comma-separated list. | ||
func HeaderAllCommaSepValues(headers http.Header, headerName string) []string { | ||
var vals []string | ||
for _, val := range headers[http.CanonicalHeaderKey(headerName)] { | ||
fields := strings.Split(val, ",") | ||
for i, f := range fields { | ||
trimmedField := strings.TrimSpace(f) | ||
fields[i] = trimmedField | ||
} | ||
vals = append(vals, fields...) | ||
} | ||
return vals | ||
} | ||
|
||
func HeaderAllCommaSepValuesString(headers http.Header, headerName string) string { | ||
valsArray := HeaderAllCommaSepValues(headers, headerName) | ||
return strings.Join(valsArray, ", ") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/darkweak/souin/plugins/beego | ||
|
||
go 1.20 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/beego/beego/v2 v2.1.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/darkweak/souin/plugins/chi | ||
|
||
go 1.20 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/darkweak/souin v1.6.45 | ||
|
Oops, something went wrong.