mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-13 15:29:12 +01:00
volume: drop proxy-specific headers from replica proxy reads
This commit is contained in:
1 parent
29d00ae794
commit
51d068a98d
2 files changed
+4
-1
No files matched your search
@@ -123,6 +123,7 @@ func (vs *VolumeServer) proxyReqToTargetServer(w http.ResponseWriter, r *http.Re
|
||||
hopByHop := map[string]bool{
|
||||
"Connection": true, "Keep-Alive": true, "Te": true, "Trailer": true,
|
||||
"Upgrade": true, "Host": true, "Content-Length": true, "Transfer-Encoding": true,
|
||||
"Proxy-Connection": true, "Proxy-Authenticate": true, "Proxy-Authorization": true,
|
||||
}
|
||||
for _, v := range r.Header.Values("Connection") {
|
||||
for _, token := range strings.Split(v, ",") {
|
||||
|
||||
@@ -220,6 +220,8 @@ func TestProxyReqToTargetServerPreservesMethodAndResponse(t *testing.T) {
|
||||
r.Header.Set("Upgrade", "h2c")
|
||||
r.Header.Set("Te", "trailers")
|
||||
r.Header.Set("X-Hop-Marker", "private")
|
||||
r.Header.Set("Proxy-Connection", "keep-alive")
|
||||
r.Header.Set("Proxy-Authorization", "Basic cHJveHk6c2VjcmV0")
|
||||
w := httptest.NewRecorder()
|
||||
vs.proxyReqToTargetServer(w, r)
|
||||
|
||||
@@ -235,7 +237,7 @@ func TestProxyReqToTargetServerPreservesMethodAndResponse(t *testing.T) {
|
||||
if got.rangeHeader != "bytes=0-3" || got.ifNoneMatch != `"client-etag"` || got.ifModifiedAt != "Wed, 21 Oct 2015 07:28:00 GMT" {
|
||||
t.Errorf("peer received conditional/range headers %+v", got)
|
||||
}
|
||||
for _, dropped := range []string{"Connection", "Keep-Alive", "Upgrade", "Te", "X-Hop-Marker"} {
|
||||
for _, dropped := range []string{"Connection", "Keep-Alive", "Upgrade", "Te", "X-Hop-Marker", "Proxy-Connection", "Proxy-Authorization"} {
|
||||
if got.header.Get(dropped) != "" {
|
||||
t.Errorf("hop-by-hop header %s reached the replica: %v", dropped, got.header)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user