]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/ocaml-http/http_parser.ml
- added debugging print of request 1st line
[helm.git] / helm / DEVEL / ocaml-http / http_parser.ml
index 1113b701edebb87d89c7d83efcb55f406f64327c..52c84570c285fed86f4af115a83f226df65580b4 100644 (file)
@@ -97,6 +97,7 @@ let debug_dump_request path params =
 
 let parse_request_fst_line ic =
   let request_line = generic_input_line ~sep:crlf ~ic in
+  debug_print (sprintf "HTTP request line (not yet parsed): %s" request_line);
   match Pcre.split ~rex:pieces_sep request_line with
   | [ meth_raw; uri_raw; http_version_raw ] ->
       (try
@@ -118,7 +119,11 @@ let parse_headers ic =
     match generic_input_line ~sep:crlf ~ic with
     | "" -> List.rev headers
     | line ->
-        (let subs = Pcre.extract ~rex:header_RE line in
+        (let subs =
+          try
+            Pcre.extract ~rex:header_RE line
+          with Not_found -> raise (Invalid_header line)
+        in
         let header =
           try
             subs.(1)