open Printf;;
open Http_common;;
+open Http_types;;
+open Http_constants;;
open Http_parser;;
let debug = true
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 =
" "
[ 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)
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
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">
<HTML><HEAD>
*)
end
- (* TODO sanity tests on location *)
let respond_redirect
~location ?(body = "") ?(version = http_version) ?(code = 301) ?status outchan
=