From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8B8S1Mb011195 for ; Sun, 11 Sep 2011 10:28:01 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiUCANNvbE7U436rimdsb2JhbABBhFWUb4gahjsUAQEBCgkNBxIFI4FSAQEEASMEUgULCxoCJgICVxkJh24CAqMNkCSBLIQxgREEjB+MM4MyiFc X-IronPort-AV: E=Sophos;i="4.68,363,1312149600"; d="scan'208";a="108491447" Received: from moutng.kundenserver.de ([212.227.126.171]) by mail4-smtp-sop.national.inria.fr with ESMTP; 11 Sep 2011 10:27:56 +0200 Received: from office1.lan.sumadev.de (dslb-188-097-002-086.pools.arcor-ip.net [188.97.2.86]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0Lmujs-1Rd68t0b4G-00hNbZ; Sun, 11 Sep 2011 10:27:55 +0200 Received: from [192.168.0.29] (dslb-084-058-033-072.pools.arcor-ip.net [84.58.33.72]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id A5DCFC00C7; Sun, 11 Sep 2011 10:27:54 +0200 (CEST) From: Gerd Stolpmann To: pierrchp@free.fr Cc: caml-list@inria.fr, ocsigen@sympa.mancoosi.univ-paris-diderot.fr In-Reply-To: <1315681085.4e6bb33d6df0e@imp.free.fr> References: <1315681085.4e6bb33d6df0e@imp.free.fr> Content-Type: text/plain; charset="UTF-8" Date: Sun, 11 Sep 2011 10:27:53 +0200 Message-ID: <1315729673.3496.247.camel@thinkpad> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:NKGe/nI8Rps6/Ass10IcHPueLxoHRgMU2uCT1CGGRW2 gH9WlJQOKkVeCH2qRqHT0nHDNmzBBGOOTUbrDq4n7kM+11UjIe EPN55KpKoERLkBbSxZBRlV3Z7shUGtR3lbGRHIbEC5KcQyj3T2 ADAHsURtrrcztpUuP37Ly1ytszqQ+ruhc7VwDl6bHwREC0gfQX oYUO7CId9JpOkqQB9QGKlZeDWuMhB4UgOr33fwGOKk9sUWIVWC m2TRYC+a5uYO1PzplpZkVTcOtUdlAIm0BDaEbmReQ8WDA2j+Ps VvePkY16975Jy4Jo6zeIHkYly3ZrB6JWIwnTcnbO6Oy625O/97 JTV4H54gLBKT9Xoqm8NeOAXhcSXDD7xBu6ni/h1aV Subject: Re: [Caml-list] Ocamlnet, netclient and lwt_preemptive causing ocsigen segfault Am Samstag, den 10.09.2011, 20:58 +0200 schrieb pierrchp@free.fr: > Hello, > > I have a web application written using lwt and ocsigen that needs to get data > using https. > > In order to do that, I use the Http_client.Convenience module from Ocamlnet, and > use Lwt.detach to perform the call (there probably is a smater way to do this, I > am open to any suggestion). The http call is performed and the data is > displayed, but then the server crashed, apparently because of a segfault. Run the server under gdb, and get a backtrace after the crash. > here is the code for a test eliom module that reproduce the problem, compiled > using > > ocamlfind ocamlc -c -thread -package > equeue-ssl,netclient,lwt,lwt.preemptive,ocsigen test_server.ml Unfortunately, it is still impossible to run Ocamlnet protocol interpreters on top of Lwt's event dispatcher. I really wished we had here a better way of combining both systems. Gerd > > Cheers > > > -Pierre > > > (*************************************) > > open Lwt > open XHTML.M > open Eliom_services > open Eliom_parameters > open Eliom_sessions > open Eliom_predefmod.Xhtml;; > > > > > (* initialising Http_client.Convenience to use https *) > Ssl.init(); > > Http_client.Convenience.configure_pipeline > (fun p -> > let ctx = Ssl.create_context Ssl.TLSv1 Ssl.Client_context in > let tct = Https_client.https_transport_channel_type ctx in > p # configure_transport Http_client.https_cb_id tct > ) > ;; > > > > module H = Http_client.Convenience > > > let test_service = new_service ~path:[""] > ~get_params:unit > () > ;; > > > let test_handler = fun sp () () -> > (* thread that request data from a url *) > Lwt_preemptive.detach (function () -> H.http_get "https://ocsigen.org") () >>= > function s -> > (*page that display the data*) > return ( > html (head (title (pcdata "test")) []) > (body [ > h1 [pcdata "the data are:"]; > p [ pcdata s] > ] > ) > ) > ;; > register test_service test_handler;; > -- ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de Creator of GODI and camlcity.org. Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de *** Searching for new projects! Need consulting for system *** programming in Ocaml? Gerd Stolpmann can help you. ------------------------------------------------------------