]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/http_getter/http_getter_env.ml
- the mathql interpreter is not helm-dependent any more
[helm.git] / helm / http_getter / http_getter_env.ml
index a531cfa7576952c2998f6e1cd1500ec8129dffef..54269279535eaf0828818a2770672d0fa24375d4 100644 (file)
@@ -3,8 +3,7 @@
  *    Stefano Zacchiroli <zack@cs.unibo.it>
  *    for the HELM Team http://helm.cs.unibo.it/
  *
- *  This file is part of HELM, an Hypertextual, Electronic
- *  Library of Mathematics, developed at the Computer Science
+ *  This file is part of HELM, an Hypertextual, Electronic *  Library of Mathematics, developed at the Computer Science
  *  Department, University of Bologna, Italy.
  *
  *  HELM is free software; you can redistribute it and/or
@@ -77,9 +76,17 @@ let safe_getenv ?(from = Both) var =
       | v -> return_value var v)))
 
 let servers_file = safe_getenv "HTTP_GETTER_SERVERS_FILE"
+
+  (* TODO BUG HERE: is commented lines are included in the servers file the
+  server index (used for example by the remove_server method) gets out of sync!
+  *)
 let parse_servers () =
-  (let cons hd tl = hd @ [ tl ] in
-  Http_getter_misc.fold_file cons [] servers_file)
+  List.rev (Http_getter_misc.fold_file
+    (fun servers line ->
+      if Http_getter_misc.is_blank_line line then servers else line::servers)
+    []
+    servers_file)
+;;
 let servers = ref (parse_servers ())
 let reload_servers () = servers := parse_servers ()