News for hackers. Stuff that matters.
Re:Golang's network stack attempts to parse HTTP headers as ... by panpanna on Thursday January 21, 2021 @07:40AM (#25858242)
> That's a terrible reason.

Consider this: all strings are utf-8, so working with pure ASCII is much more work in golang.

It leads to all kind of issues, not only security problems.

Re:Golang's network stack attempts to parse HTTP headers as ... by kerng on Thursday January 21, 2021 @08:06AM (#25858408)
But that's a Golang issue then, not http
Re:Golang's network stack attempts to parse HTTP headers as ... by panpanna on Thursday January 21, 2021 @08:47AM (#25858709)
I know, I am just trying to explain how this could happen :)
Re:Golang's network stack attempts to parse HTTP headers as ... by _-___________-_ on Thursday January 21, 2021 @10:46PM (#25868085)
Yes, but this simply means that header values are not (Go) strings, they're byte arrays. Many languages represent them this way, with a (fallible) function to get the string value iff the byte array contains valid UTF-8.

The whole "it would be more work" as a justification for not doing things properly is one of the roots of the more general issues with Go I alluded to in my post above.

Re:Golang's network stack attempts to parse HTTP headers as ... by 0xjnml on Friday January 22, 2021 @05:59PM (#25877373)
1) Go string type is specified as a sequence of bytes. Full stop. Any encoding, binary blob, string does not care. Particular stdlib string functions _do_ care, expect UTF-8 encoding and document the fact. Other stdlib string function work with the sequence as a sequence.

3) Go specification requires UTF-8 in only one place: the encoding of Go source files string literals.

2) Pure ASCII is a subset of UTF-8, ie. pure ASCII _is_ valid UTF-8. There is _no_ more work and there are _no_ security problems when working with pure ASCII as UTF-8, because that's what it is.