From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 0C2C1BC57 for ; Tue, 21 Sep 2010 21:20:50 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAHuimExQRFuw/2dsb2JhbACiKnHEcIVBBA X-IronPort-AV: E=Sophos;i="4.56,401,1280700000"; d="scan'208";a="61199656" Received: from furbychan.cocan.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 21 Sep 2010 21:20:49 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1Oy8OW-0006iu-8P; Tue, 21 Sep 2010 20:20:48 +0100 Date: Tue, 21 Sep 2010 20:20:48 +0100 To: ben kuin Cc: caml-list@inria.fr Subject: Re: [Caml-list] web server interface for Ocaml ( like rack, wsgi, ...)? Message-ID: <20100921192048.GA25700@annexia.org> References: <20100919103258.GA14826@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Spam: no; 0.00; ocaml:01 0200,:01 ocamlnet:01 compilation:01 ocaml:01 wikipedia:01 lambda:01 usr:01 ocamlrun:01 ocamlnet:01 gerd:01 wrote:01 caml-list:01 bin:01 parse:02 On Tue, Sep 21, 2010 at 09:50:36AM +0200, ben kuin wrote: > > what's wrong with simply proxying the HTTP connections through your favorite webserver to the backend ocsigen/ocamlnet server? > > Nothing per se. I've tried so set something up with ocsigen, but I had > to give up. There seems to be a certain philosophy behind it how you > should writing web apps. > > But I just wanted to do something: > - small ( one page app ) > - quick and dirty ( no big setup upfront, no compilation) > - deployment, by dropping a (ocaml script) into a webroot, not matter > what webserver is running > - permissive license ( mit, ...) > > ~~~~ from wikipedia ~~~~ > require 'rack' > app = Rack::Builder.app do > lambda do |env| > body = "Hello, World!" > [200, {"Content-Type" => "text/plain", "Content-Length" => > body.length.to_s}, [body]] > end > end This ought to work, and it's pretty simple ... ----- #!/usr/bin/ocamlrun ocaml print_string "\ Content-Type: text/plain Hello, World!" ----- 'course the problem is you'll be wanting to parse parameters, cookies and the rest of it, and there it does get a little bit more complicated. I'm fairly sure ocamlnet can write standalone scripts like that? Gerd?? Rich. -- Richard Jones Red Hat