Parcourir la source

fix read request

cnlh il y a 5 ans
Parent
commit
b43bcb1c96
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      lib/conn/conn.go

+ 3 - 0
lib/conn/conn.go

@@ -43,6 +43,9 @@ func (s *Conn) readRequest(buf []byte) (n int, err error) {
 			return
 		}
 		n += rd
+		if n < 4 {
+			continue
+		}
 		if string(buf[n-4:n]) == "\r\n\r\n" {
 			return
 		}