Hi Jakob,

I am not knowledgeable enough about the Links internals to help with your 
question, but I just wanted to say that I think it's a great idea to make it 
possible to run Links using ocaml-http, so that you can run Links programs in 
web mode without having to do all the web server configuration nonsense.  Lots 
of other Web programming frameworks (e.g. Rails) support something like this 
and I think lack of this capability makes the learning curve for (potential) 
casual users of Links much steeper.  So, I hope someone will be able to 
incorporate your patch soon.

It would help to know what version of Links you used as a starting point (e.g. 
version 0.5 or revision number from the SVN repository).  If you are working 
with a local copy of the SVN repository then maybe the best thing would be for 
you to make a branch that we can try out.  I guess Sam would need to give you 
write-access first though.

--James

> 
> Hi,
> 
>   attached please find a patch that embeds the ocaml-http library
> inside of links.
> 
> Since this is my first try at working on OCaml I am greatful to get
> feedback.
> I am using a variant type
> 
>     type webrequest = HttpRequest of Http_types.request * out_channel
>          | CgiRequest of string (*filename*)
> 
> to differentiate between Cgi and HttpServer mode. First I tried to use
> an abstract module type and two modules plus a functor for working on
> the abstract module, but I had a problem when wanting to convert the
> Http_types.request into the abstract type. (CgiRequest and HttpRequest
> would had different make arguments which could not be defined in the
> abstract signature's make).
> 
> To run links in web server mode, pass -s as an argument. Other useful
> arguments are -p <port>, -r <webroot>.
> 
> The biggest issue which is not adressed is that Lib stores some
> references that are not thread safe. Instead of writing on
> Lib.print_http_response somewhere in the code there exists an exception
> HttpResponse in the Lib module, that is raised in Evalir module and
> caught in the Webif module at a common location. Other uses are ignored
> in this patch. I am open to discussion how to best make this thread safe
> (e.g. introducing a new parameter to all the code seems tedious but
> maybe prettier and better testable than abstractable than refs in TLS...).
> 
> Best,
> Jakob


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

_______________________________________________
links-users mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/links-users

Reply via email to