Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
CamlGI question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-04-19 (11:34)
From: Christophe TROESTLER <debian00@t...>
Subject: Re: [Caml-list] CamlGI question
On Mon, 18 Apr 2005, Mike Hamburg <> wrote:
> Is CamlGI still actively maintained?  I'm writing a CGI/FastCGI
> program using it, and have been having some trouble with the library.

It is -- I just do not have much time to care about it.


I downloaded your files.  For a start, all the modules are -pack'ed
into[x]a, so you only need to link with that file.  Also,
the interface of the library is in camlGI.mli with complete
documentation.  In particular, you should not use hidden submodules:
e.g. in "", say [open CamlGI] and then [Cgi.HttpError] instead
of [Cgi_types.HttpError].  Same in "": you should say [open
CamlGI.Cgi], not [open Cgi].

[Request.metavar rq.rq "SERVER_NAME"] can simply be replaced with
[Request.server_name rq.rq]

[cgi#header_was_emitted ()]: such method does not exist in the public

I do not see why you set [rq=request] as the request can be gotten
from the cgi object [cgi#request].

> When used as a FastCGI, the indexing script hangs, [...] It is quite
> clear that the script has finished by the time the hang occurs

Do the examples provided with the lib work as they should?

Are you sure your [main] function actually terminates?  Indeed, the
output is buffered (at least by CamlGI) and may not be fully outputted
until the script finishes.  Also, if you wish to launch a new
process/thread per request, be sure to use the [fork] optional
parameter to [handle_requests ?fork f conn] -- otherwise [f] will
return immediately and the output "channel" will be closed early.

CamlGI follows closely the spec -- even the multiplexing part which is
not implemented by many.

> The plain CGI version works just fine

CGI output is not buffered.

> the features of the script only work in the FastCGI version, such as
> thumbnailing.

Why is that?  Do you need persistence for that?

Hope it helps.  If it does not, send me an example (if possible
minimal but definitely self-contained) that exhibits the undesired
behavior and I'll have a look.