Added a check for malformed headers
This commit is contained in:
parent
d58f68f3fe
commit
bb5d849cd9
3 changed files with 25 additions and 0 deletions
|
@ -136,6 +136,26 @@ func TestBadRequestProtocol(t *testing.T) {
|
|||
s.Run(":8080")
|
||||
}
|
||||
|
||||
func TestConnectionClose(t *testing.T) {
|
||||
s := web.NewServer()
|
||||
|
||||
go func() {
|
||||
defer syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
|
||||
|
||||
conn, err := net.Dial("tcp", ":8080")
|
||||
assert.Nil(t, err)
|
||||
defer conn.Close()
|
||||
|
||||
_, err = io.WriteString(conn, "GET / HTTP/1.1\r\nConnection: close\r\n\r\n")
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, err = io.ReadAll(conn)
|
||||
assert.Nil(t, err)
|
||||
}()
|
||||
|
||||
s.Run(":8080")
|
||||
}
|
||||
|
||||
func TestEarlyClose(t *testing.T) {
|
||||
s := web.NewServer()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue