fix: preserve web device session headers
This commit is contained in:
@@ -135,6 +135,8 @@ func TestSanitizeProxyRequestHeaderDropsLoginCookie(t *testing.T) {
|
||||
source.Set("User-Agent", "browser")
|
||||
source.Set("Cookie", "SID=1")
|
||||
source.Set("Referer", "http://10.8.0.18:13000/proxy/web/192.168.0.108/")
|
||||
source.Set("Sessiontag", "abc123")
|
||||
source.Set("If-Modified-Since", "0")
|
||||
source.Set("X-Forwarded-For", "10.8.0.1")
|
||||
|
||||
loginHeader := sanitizeProxyRequestHeader(source, "/doc/page/login.asp")
|
||||
@@ -147,9 +149,18 @@ func TestSanitizeProxyRequestHeaderDropsLoginCookie(t *testing.T) {
|
||||
if got := loginHeader.Get("X-Forwarded-For"); got != "" {
|
||||
t.Fatalf("login X-Forwarded-For = %q, want empty", got)
|
||||
}
|
||||
if got := loginHeader.Get("Sessiontag"); got != "abc123" {
|
||||
t.Fatalf("login Sessiontag = %q, want abc123", got)
|
||||
}
|
||||
|
||||
apiHeader := sanitizeProxyRequestHeader(source, "/ISAPI/Security/userCheck")
|
||||
if got := apiHeader.Get("Cookie"); got != "SID=1" {
|
||||
t.Fatalf("api Cookie = %q, want SID=1", got)
|
||||
}
|
||||
if got := apiHeader.Get("Sessiontag"); got != "abc123" {
|
||||
t.Fatalf("api Sessiontag = %q, want abc123", got)
|
||||
}
|
||||
if got := apiHeader.Get("If-Modified-Since"); got != "0" {
|
||||
t.Fatalf("api If-Modified-Since = %q, want 0", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user