(* Http_common.debug := true;; *)
(** accepted HTTP servers for ask_uwobo method forwarding *)
-let valid_servers = [ "mowgli.cs.unibo.it:58080" ] ;;
+let valid_servers = [ "mowgli.cs.unibo.it:58080" ; "localhost:58080" ] ;;
open Printf;;
let iter_file f = fold_file (fun _ line -> f line) ()
let (title_tag_RE, choices_tag_RE, msg_tag_RE, id_to_uris_RE, id_RE,
- interpretations_RE, interpretations_labels_RE, results_RE, new_aliases_RE,
- processorURL_RE)
+ interpretations_RE, interpretations_labels_RE, results_RE, new_aliases_RE)
=
(Pcre.regexp "@TITLE@", Pcre.regexp "@CHOICES@", Pcre.regexp "@MSG@",
Pcre.regexp "@ID_TO_URIS@", Pcre.regexp "@ID@",
Pcre.regexp "@INTERPRETATIONS@", Pcre.regexp "@INTERPRETATIONS_LABELS@",
- Pcre.regexp "@RESULTS@", Pcre.regexp "@NEW_ALIASES@",
- Pcre.regexp "@processorURL@")
+ Pcre.regexp "@RESULTS@", Pcre.regexp "@NEW_ALIASES@")
let server_and_port_url_RE = Pcre.regexp "^http://([^/]+)/.*$"
let port =
(fun line ->
output_string outchan
((apply_substs
- [processorURL_RE, req#param "processorURL"] line) ^
+ (List.map
+ (function (key,value) ->
+ let key' =
+ (Pcre.extract ~pat:"param\\.(.*)" key).(1)
+ in
+ Pcre.regexp ("@" ^ key' ^ "@"), value
+ )
+ (List.filter
+ (fun (key,_) as p-> Pcre.pmatch ~pat:"^param\\." key)
+ req#params)
+ )
+ line) ^
"\n"))
fname
end else