-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheaders.go
More file actions
46 lines (39 loc) · 730 Bytes
/
headers.go
File metadata and controls
46 lines (39 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import "net/http"
// client -> upstream
var clientHeaders = []string{
"Range",
"If-None-Match",
"If-Modified-Since",
"Accept",
"Accept-Encoding",
}
// upstream -> client
var upstreamHeaders = []string{
"Content-Type",
"Content-Encoding",
"Content-Range",
"Accept-Ranges",
"ETag",
"Last-Modified",
"Expires",
"Content-Disposition",
}
func copyUpstreamHeaders(dst http.Header, src http.Header) {
for _, k := range upstreamHeaders {
if vv, ok := src[k]; ok {
for _, v := range vv {
dst.Add(k, v)
}
}
}
}
func copyClientHeaders(dst http.Header, src http.Header) {
for _, k := range clientHeaders {
if vv, ok := src[k]; ok {
for _, v := range vv {
dst.Add(k, v)
}
}
}
}