X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2FDEVEL%2Focaml-http%2Fhttp_parser.ml;h=b92a844e3cfd1a230e33c6b0a27c98deb2bea71e;hb=b68e52f889215ce2c21c3d771f59b2d2057d53c1;hp=af371bb1ebd613c0bab0db53d3b68fd75dceafba;hpb=d43522a6d38fcb9081a3f0352088377bc0555231;p=helm.git diff --git a/helm/software/DEVEL/ocaml-http/http_parser.ml b/helm/software/DEVEL/ocaml-http/http_parser.ml index af371bb1e..b92a844e3 100644 --- a/helm/software/DEVEL/ocaml-http/http_parser.ml +++ b/helm/software/DEVEL/ocaml-http/http_parser.ml @@ -151,6 +151,28 @@ let parse_headers ic = in parse_headers' [] +let parse_cookies raw_cookies = + prerr_endline ("raw cookies: '" ^ raw_cookies ^ "'"); + let tokens = + let lexbuf = Lexing.from_string raw_cookies in + let rec aux acc = + match Cookie_lexer.token lexbuf with + | `EOF -> acc + | token -> aux (token :: acc) + in + List.rev (aux []) + in + let rec aux = function + | [ `TOKEN n ; `ASSIGN ; (`TOKEN v | `QSTRING v) ] -> + prerr_endline ("found cookie " ^ n ^ " " ^ v); + [ (n,v) ] + | `TOKEN n :: `ASSIGN :: (`TOKEN v | `QSTRING v) :: `SEP :: tl -> + prerr_endline ("found cookie " ^ n ^ " " ^ v); + (n,v) :: aux tl + | _ -> raise (Malformed_cookies raw_cookies) + in + aux tokens + let parse_request ic = let (meth, uri, version) = parse_request_fst_line ic in let path = parse_path uri in