From 63e86a8e981cda7b7e4438b48ce622b7c222cc42 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Thu, 26 Jun 2003 12:14:18 +0000 Subject: [PATCH] Ported to the latest version of libhttp --- helm/graphs/tools/Makefile | 4 ++-- helm/graphs/tools/uriSetQueue.ml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/helm/graphs/tools/Makefile b/helm/graphs/tools/Makefile index 8246a81da..cbcc16946 100644 --- a/helm/graphs/tools/Makefile +++ b/helm/graphs/tools/Makefile @@ -3,8 +3,8 @@ DOT=../gv1.7c/bin/dot SED=sed "s/font-family:Times;//g" REQUIRES = http -PREDICATES = -OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" +PREDICATES = mt +OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -thread OCAMLC = ocamlfind ocamlc $(OCAMLOPTIONS) OCAMLOPT = ocamlfind ocamlopt $(OCAMLOPTIONS) diff --git a/helm/graphs/tools/uriSetQueue.ml b/helm/graphs/tools/uriSetQueue.ml index 29482c268..12b7e91c0 100644 --- a/helm/graphs/tools/uriSetQueue.ml +++ b/helm/graphs/tools/uriSetQueue.ml @@ -86,9 +86,9 @@ let port = prerr_endline "Warning: invalid port, reverting to default"; default_port in -let callback req outchan = +let callback (req: Http_types.request) outchan = try - let res = new Http_response.response in + let res = new Http_response.response () in res#addBasicHeaders; res#setContentType "text/xml"; (match req#path with @@ -118,7 +118,7 @@ let callback req outchan = end end in - res#setContents (sprintf "\n<%s/>\n" result); + res#setBody (sprintf "\n<%s/>\n" result); if debug then res#serialize stderr; Http_daemon.respond_with res outchan @@ -127,7 +127,7 @@ let callback req outchan = let queue = get_queue pid in let result = string_of_bool (queue.overflowed) in debug_print (sprintf "%d queue is_overflowed = %s" pid result); - res#setContents (sprintf "\n<%s/>\n" result); + res#setBody (sprintf "\n<%s/>\n" result); if debug then res#serialize stderr; Http_daemon.respond_with res outchan @@ -142,7 +142,7 @@ let callback req outchan = with Queue_not_found p -> assert (p = pid); add_queue pid size); - res#setContents "\n\n"; + res#setBody "\n\n"; if debug then res#serialize stderr; Http_daemon.respond_with res outchan @@ -160,7 +160,7 @@ let callback req outchan = uri with Queue.Empty -> "" in - res#setContents ("\n" ^ element ^ "\n"); + res#setBody ("\n" ^ element ^ "\n"); if debug then res#serialize stderr; Http_daemon.respond_with res outchan @@ -168,7 +168,7 @@ let callback req outchan = let pid = int_of_string (req#param "PID") in remove_queue pid; debug_print (sprintf "Resetting queue '%d'" pid); - res#setContents "\n\n"; + res#setBody "\n\n"; if debug then res#serialize stderr; Http_daemon.respond_with res outchan @@ -177,7 +177,7 @@ let callback req outchan = Http_daemon.respond_error ~status:(`Client_error `Bad_request) outchan); prerr_endline "Request done!\n" with - | Http_request.Param_not_found attr_name -> + | Http_types.Param_not_found attr_name -> Http_daemon.respond_error ~status:(`Client_error `Bad_request) ~body:(sprintf "Parameter '%s' is missing" attr_name) @@ -193,6 +193,6 @@ in printf "%s started and listening on port %d\n" daemon_name port; flush stdout; -Http_daemon.start' ~port ~fork:false callback; +Http_daemon.start' ~port ~mode:`Thread callback; printf "%s is terminating, bye!\n" daemon_name -- 2.39.2