From 2f51b111776eeef4aa0336ebb1294b304f479809 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Tue, 3 Dec 2002 21:32:31 +0000 Subject: [PATCH] - added sanity test on headers while using send_header{,s} --- helm/DEVEL/ocaml-http/http_daemon.ml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/helm/DEVEL/ocaml-http/http_daemon.ml b/helm/DEVEL/ocaml-http/http_daemon.ml index f2f70a037..bcf3da81a 100644 --- a/helm/DEVEL/ocaml-http/http_daemon.ml +++ b/helm/DEVEL/ocaml-http/http_daemon.ml @@ -22,6 +22,8 @@ open Printf;; open Http_common;; +open Http_types;; +open Http_constants;; open Http_parser;; let debug = true @@ -43,8 +45,8 @@ let send_raw ~data outchan = let send_CRLF = send_raw ~data:crlf - (** TODO perform some sanity test on header and value *) let send_header ~header ~value = + Http_parser.heal_header (header, value); send_raw ~data:(header ^ ": " ^ value ^ crlf) let send_headers ~headers outchan = @@ -69,7 +71,7 @@ let send_status_line' ~version ~code = " " [ string_of_version version; string_of_int code; - reason_phrase_of_code code ] + Http_misc.reason_phrase_of_code code ] in send_raw ~data:(status_line ^ crlf) @@ -92,7 +94,7 @@ let send_basic_headers ?(version = http_version) ?code ?status outchan = representing an HTML document that explains the meaning of given status code. Additional data can be added to the body via 'body' argument *) let foo_body code body = - let reason_phrase = reason_phrase_of_code code in + let reason_phrase = Http_misc.reason_phrase_of_code code in sprintf " @@ -156,7 +158,6 @@ let send_empty_response *) end - (* TODO sanity tests on location *) let respond_redirect ~location ?(body = "") ?(version = http_version) ?(code = 301) ?status outchan = -- 2.39.2