Version française
Home     About     Download     Resources     Contact us    
Browse thread
nethttpd: Describing handlers with netcgi2
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Joel Reymont <joelr1@g...>
Subject: nethttpd: Describing handlers with netcgi2
I'm trying to compile the netplex example with netcgi2 instead of  
netcgi1. I get

make netplex
ocamlfind ocamlc -o netplex -package "netstring,netcgi2,unix,nethttpd- 
for-netcgi2,netplex" \
         -thread netplex.ml -linkpkg -g

File "netplex.ml", line 178, characters 48-55:
This expression has type Netcgi.cgi_activation -> unit
but is here used with type
   (#Netcgi1_compat.Netcgi_types.cgi_activation as 'a) -> unit

The stumbling block is the dyn_handler assignment below.

   let adder =
     { Nethttpd_services.dyn_handler = (fun _ -> process);
       dyn_activation = Nethttpd_services.std_activation  
`Std_activation_buffered;
       dyn_uri = None;                 (* not needed *)
       dyn_translator = (fun _ -> ""); (* not needed *)
       dyn_accept_all_conditionals = false;
     } in
   let nethttpd_factory =
     Nethttpd_plex.nethttpd_factory
       ~handlers:[ "adder", adder ]
       () in

Looking at the porting guide[1] I gather that this chunk

(* This is [netcgi1] code! *)
let cgi = new Netcgi.std_activation() in
process cgi
should be replaced with this

(* This is [netcgi2] code! *)
Netcgi_cgi.run process

What should I plug in instead of process into dyn_handler, though?

	Thanks in advance, Joel

[1] http://ocamlnet.sourceforge.net/manual-2.2/Netcgi_porting.html

--
http://wagerlabs.com/