mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-23 17:18:42 +00:00
ipn/ipnlocal: q-encode (RFC 2047) Tailscale serve header values
Updates #11603 RELNOTE=Tailscale serve headers are now RFC 2047 Q-encoded Change-Id: I1314b65ecf5d39a5a601676346ec2c334fdef042 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
262fa8a01e
commit
b9611461e5
@@ -823,3 +823,21 @@ func Test_isGRPCContentType(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncTailscaleHeaderValue(t *testing.T) {
|
||||
tests := []struct {
|
||||
in string
|
||||
want string
|
||||
}{
|
||||
{"", ""},
|
||||
{"Alice Smith", "Alice Smith"},
|
||||
{"Bad\xffUTF-8", ""},
|
||||
{"Krūmiņa", "=?utf-8?q?Kr=C5=ABmi=C5=86a?="},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
got := encTailscaleHeaderValue(tt.in)
|
||||
if got != tt.want {
|
||||
t.Errorf("encTailscaleHeaderValue(%q) = %q, want %q", tt.in, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user