X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fgraphs%2Ftools%2FuriSetQueue.ml;h=12b7e91c0b95bd591c7f45b82349ac800eea8851;hb=1c7fb836e2af4f2f3d18afd0396701f2094265ff;hp=1bb6b5ee4c4fa58c83eeb41b0f7733a46e4a020e;hpb=751d9e7e83a33c73c879bb6503af3cc7ad9f9a88;p=helm.git diff --git a/helm/graphs/tools/uriSetQueue.ml b/helm/graphs/tools/uriSetQueue.ml index 1bb6b5ee4..12b7e91c0 100644 --- a/helm/graphs/tools/uriSetQueue.ml +++ b/helm/graphs/tools/uriSetQueue.ml @@ -23,9 +23,9 @@ * http://cs.unibo.it/helm/. *) -Http_common.debug := true;; let debug = true;; let debug_print s = if debug then prerr_endline s;; +Http_common.debug := debug;; open Printf;; @@ -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