2016. december 13., kedd 14:57:47 UTC+1 időpontban kaitoY Kors a következőt írta: > > Hello, > > In the current implementation of net/http and net/textproto, other than > iterating all the key/value pairs of Header, type map[string][]string, is > there any other way to get the total size effectively? > The concern is if the header contains lots of key/value pairs, it might be > inefficient to get the size by walking through the map. > > Any advice/comment is appreciated. > Thanks in advance >
Why do you need the total size? Content-Length is just the body. At the time you get the *http.Request in your handler, it's already parsed. If you want to limit the header's size, use net/http.Server.MaxHeaderSize. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.