File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,10 @@ let parse_ ~(buf : Buf.t) (bs : IO.Input.t) : t =
5050 let rec loop acc =
5151 match IO.Input. read_line_using_opt ~buf bs with
5252 | None -> raise End_of_file
53+ | Some "" -> assert false
5354 | Some "\r " -> acc
55+ | Some line when line.[String. length line - 1 ] <> '\r' ->
56+ bad_reqf 400 " bad header line, not ended in CRLF"
5457 | Some line ->
5558 let k, v =
5659 try
Original file line number Diff line number Diff line change @@ -110,6 +110,9 @@ let parse_req_start ~client_addr ~get_time_s ~buf (bs : IO.Input.t) :
110110 try
111111 let line = IO.Input. read_line_using ~buf bs in
112112 Log. debug (fun k -> k " parse request line: %S" line);
113+
114+ if line <> " " && line.[String. length line - 1 ] <> '\r' then
115+ bad_reqf 400 " invalid status line, not ending in CRLF" ;
113116 let start_time = get_time_s () in
114117 let meth, path, version =
115118 try
You can’t perform that action at this time.
0 commit comments