News for hackers. Stuff that matters.
Re:Go: What We Got Right, What We Got Wrong by aatd86 on Friday January 05, 2024 @06:39AM (#38878083)
Wait, are the headers canonicalized if you retrieve them from r.Header where r is a request?

I mean, if the safest is to conform to the html spec, there should be an escape hatch for the rarer cases easier than going all the way to the tcp level?

Re:Go: What We Got Right, What We Got Wrong by opportune on Sunday January 07, 2024 @07:25PM (#38906700)
It's been a while since I battled this but IIRC, you can set unconcalized headers on requests you serialize yourself (for egress) with a simple workaround (directly add the header to the request's header map rather than the setter function) but if you use Go's default http handler libraries, it "helpfully" canonicalizes headers for you when it deserializes incoming requests and then invokes your http handler. So you are unable to access to the original casing that way, unless you instead use a TCP server.