debug_print ("Connection from " ^ req#clientAddr);
debug_print ("Received request: " ^ req#path);
(match req#path with
- | "/help" -> return_html_msg Http_getter_const.usage_string outchan
+ | "/help" -> return_html_raw Http_getter_const.usage_string outchan
| "/getxml" | "/getxslt" | "/getdtd" | "/resolve" | "/register" ->
(let uri = req#param "uri" in (* common parameter *)
match req#path with
~patch ~url:(Http_getter_env.dtd_dir ^ "/" ^ uri) outchan
| "/resolve" ->
(try
- return_xml_msg
+ return_xml_raw
(sprintf "<url value=\"%s\" />\n" (resolve uri))
outchan
with Http_getter_unresolvable_URI uri ->
- return_xml_msg "<unresolved />\n" outchan)
+ return_xml_raw "<unresolved />\n" outchan)
| "/register" ->
let url = req#param "url" in
register uri url;
let return_html_error = mk_return_fun pp_error "text/html"
let return_html_internal_error = mk_return_fun pp_internal_error "text/html"
let return_html_msg = mk_return_fun pp_msg "text/html"
-let return_xml_msg = mk_return_fun null_pp "text/xml"
+let return_html_raw = mk_return_fun null_pp "text/html"
+let return_xml_raw = mk_return_fun null_pp "text/xml"
let return_file ~fname ?contype ?contenc ?(patch_fun = fun x -> x) outchan =
let headers =
match (contype, contenc) with
val return_html_error: string -> out_channel -> unit
val return_html_internal_error: string -> out_channel -> unit
+ (** return an HTML HTTP response from the given string, embedding it in an
+ "H1" element of an HTML page; content-type is set to text/html *)
val return_html_msg: string -> out_channel -> unit
-val return_xml_msg: string -> out_channel -> unit
+ (** return an HTTP response using given string as content; content-type is set
+ to text/html *)
+val return_html_raw: string -> out_channel -> unit
+ (** return an HTTP response using given string as content; content-type is set
+ to text/xml *)
+val return_xml_raw: string -> out_channel -> unit
(** return a bad request http response *)
val return_400: string -> out_channel -> unit
(**