2
srv := &http.Server{
Addr: "127.0.0.1:8080",
Handler: r,
MaxHeaderBytes: 1,
}
srv.ListenAndServe()
我用自定義標題和應用程序提供了幾個請求,沒有任何錯誤。我做錯了什麼?MaxHeaderBytes真的有效嗎?
srv := &http.Server{
Addr: "127.0.0.1:8080",
Handler: r,
MaxHeaderBytes: 1,
}
srv.ListenAndServe()
我用自定義標題和應用程序提供了幾個請求,沒有任何錯誤。我做錯了什麼?MaxHeaderBytes真的有效嗎?
是的,它的確如此,但它們會爲您指定的任何內容添加一點填充。在the code他們添加4096個字節的限制由於某種原因。