Added a check for malformed request paths
This commit is contained in:
parent
934e8e7206
commit
cdad24e2f7
3 changed files with 30 additions and 1 deletions
|
@ -157,7 +157,14 @@ func (s *server) handleConnection(conn net.Conn) {
|
|||
lastSpace = len(message) - len("\r\n")
|
||||
}
|
||||
|
||||
url = message[space+1 : lastSpace]
|
||||
space += 1
|
||||
|
||||
if space > lastSpace {
|
||||
io.WriteString(conn, "HTTP/1.1 400 Bad Request\r\n\r\n")
|
||||
return
|
||||
}
|
||||
|
||||
url = message[space:lastSpace]
|
||||
|
||||
// Add headers until we meet an empty line
|
||||
for {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue