-
(* Copyright (C) 2002, HELM Team.
*
* This file is part of HELM, an Hypertextual, Electronic
let result = MQueryGenerator.locate id in
Http_daemon.respond ~headers:[contype] ~body:(pp_result result) outchan
| "/getpage" ->
+ (* TODO implement "is_permitted" *)
(let is_permitted _ = true in
let remove_fragment uri = Pcre.replace ~pat:"#.*" uri in
- match req#param "url" with
- | page when is_permitted (remove_fragment page) ->
+ let page = remove_fragment (req#param "url") in
+ match page with
+ | page when is_permitted page ->
Http_daemon.respond_file
- ~fname:(sprintf "%s/%s" pages_dir (remove_fragment page)) outchan
+ ~fname:(sprintf "%s/%s" pages_dir page) outchan
| page -> Http_daemon.respond_forbidden ~url:page outchan)
| "/searchPattern" ->
let term_string = req#param "term" in
let must = MQueryLevels2.get_constraints term' in
let must',only = refine_constraints must in
let results = MQueryGenerator.searchPattern must' only in
- debug_print "FASE 3";
iter_file
(fun line ->
let new_aliases =
| exc ->
Http_daemon.respond
~body:(pp_error ("Uncaught exception: " ^ (Printexc.to_string exc)))
- outchan
+ outchan
in
printf "%s started and listening on port %d\n" daemon_name port;
printf "current directory is %s\n" (Sys.getcwd ());