]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/http_getter/main.ml
ported to latest ocaml-http API
[helm.git] / helm / http_getter / main.ml
index 6501afdafb61799a08642c16df98667a1d4eae5c..8fa671ab9febd8ae04b44c687cca723f40505aee 100644 (file)
@@ -123,10 +123,11 @@ 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_html_raw = mk_return_fun null_pp "text/html"
 let return_xml_raw = mk_return_fun null_pp "text/xml"
-let return_400 body outchan = Http_daemon.respond_error ~code:400 ~body outchan
+let return_400 body outchan =
+  Http_daemon.respond_error ~code:(`Code 400) ~body outchan
 
 let return_all_foo_uris doctype uris outchan =
-  Http_daemon.send_basic_headers ~code:200 outchan;
+  Http_daemon.send_basic_headers ~code:(`Code 200) outchan;
   Http_daemon.send_header "Content-Type" "text/xml" outchan;
   Http_daemon.send_headers common_headers outchan;
   Http_daemon.send_CRLF outchan;
@@ -233,7 +234,7 @@ let log_failure msg = Http_getter_logger.log ("Request not fulfilled: " ^ msg)
    * given output channel. Response is sent embedded in an HTML document.
    * Channel is closed afterwards. *)
 let send_log_to ?prepend action outchan =
-  Http_daemon.send_basic_headers ~code:200 outchan;
+  Http_daemon.send_basic_headers ~code:(`Code 200) outchan;
   Http_daemon.send_header "Content-Type" "text/html" outchan;
   Http_daemon.send_CRLF outchan;
   output_string outchan "<html><body>\n"; flush outchan;
@@ -306,7 +307,8 @@ let callback (req: Http_types.request) outchan =
     | "/getempty" ->
         Http_daemon.respond ~body:Http_getter_const.empty_xml outchan
     | invalid_request ->
-        Http_daemon.respond_error ~status:(`Client_error `Bad_request) outchan);
+        Http_daemon.respond_error ~code:(`Status (`Client_error `Bad_request))
+          outchan);
     Http_getter_logger.log "Done!\n"
   with
   | Http_types.Param_not_found attr_name ->