TestHeaderNameCheckTakesTheRFC9110Characters passed string(char) for a byte, which for 0x80 to 0xff is the two-byte UTF-8 of U+0080 to U+00FF. Half of the names it called single-byte were not checked. It now builds each name from the byte itself. Model: opus-5-5
This commit is contained in:
1 parent
f9e034b885
commit
b110cfabe8
1 file changed
+5
-2
@@ -883,8 +883,11 @@ func TestHeaderNameCheckTakesTheRFC9110Characters(t *testing.T) {
|
||||
want := 'a' <= char && char <= 'z' || 'A' <= char && char <= 'Z' ||
|
||||
'0' <= char && char <= '9' || strings.IndexByte(marks, char) >= 0
|
||||
|
||||
if got := httpguts.ValidHeaderFieldName(string(char)); got != want {
|
||||
t.Errorf("the name %q is taken: %t, want %t", char, got, want)
|
||||
// string(char) would be the UTF-8 of U+0080 to U+00FF, two bytes,
|
||||
// for a byte above 0x7f.
|
||||
name := string([]byte{char})
|
||||
if got := httpguts.ValidHeaderFieldName(name); got != want {
|
||||
t.Errorf("the name %q is taken: %t, want %t", name, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user