--- a/src/Tools/WWW_Find/find_theorems.ML Mon May 30 17:07:48 2011 +0200
+++ b/src/Tools/WWW_Find/find_theorems.ML Mon May 30 17:07:48 2011 +0200
@@ -11,17 +11,7 @@
fun app_index f xs = fold_index (fn x => K (f x)) xs ();
-fun parse_request (ScgiReq.Req {request_method, query_string, ...}, content, send) =
- (case request_method of
- ScgiReq.Get => query_string
- | ScgiReq.Post =>
- content
- |> Byte.bytesToString
- |> HttpUtil.parse_query_string
- | ScgiReq.Head => raise Fail "Cannot handle Head requests.",
- send);
-
-fun find_theorems (arg_data, send) =
+fun find_theorems arg_data send =
let
val args = Symtab.lookup arg_data;
@@ -66,7 +56,7 @@
in
val () = Printer.show_question_marks_default := false;
-val () = ScgiServer.register ("find_theorems", SOME Mime.html, find_theorems o parse_request);
+val () = ScgiServer.register ("find_theorems", SOME Mime.html, ScgiServer.simple_handler find_theorems);
end;
--- a/src/Tools/WWW_Find/scgi_server.ML Mon May 30 17:07:48 2011 +0200
+++ b/src/Tools/WWW_Find/scgi_server.ML Mon May 30 17:07:48 2011 +0200
@@ -11,6 +11,7 @@
val register : (string * Mime.t option * handler) -> unit
val server : string -> int -> unit
val server' : int -> string -> int -> unit (* keeps trying for port *)
+ val simple_handler : (string Symtab.table -> (string -> unit) -> unit) -> handler
end;
structure ScgiServer : SCGI_SERVER =
@@ -121,5 +122,15 @@
server' (countdown - 1) server_prefix port);
end;
+fun simple_handler h (ScgiReq.Req {request_method, query_string, ...}, content, send) =
+ h (case request_method of
+ ScgiReq.Get => query_string
+ | ScgiReq.Post =>
+ content
+ |> Byte.bytesToString
+ |> HttpUtil.parse_query_string
+ | ScgiReq.Head => raise Fail "Cannot handle Head requests.")
+ send;
+
end;