Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does MaxHeaderBytes really works?

Tags:

go

srv := &http.Server{
    Addr:           "127.0.0.1:8080",
    Handler:        r,
    MaxHeaderBytes: 1,
}
srv.ListenAndServe()

I made several requests by curl with custom headers, and app serving it, without any errors. What I am doing wrong?

like image 921
Alex Avatar asked Oct 18 '22 21:10

Alex


1 Answers

Yes, it does, but they add a bit of padding to whatever you specify. In the code they add 4096 bytes to the limit for some reason.

like image 74
captncraig Avatar answered Oct 22 '22 03:10

captncraig