Re: Http_client.Http_protocol (Unix.Unix_error (Unix.EINPROGRESS, "connect", "")).

Gerd Stolpmann <[email protected]> Thu, 29 Dec 2011 00:32:49 +0100
Newsgroups gmane.comp.lang.ocaml.lib.net.devel
Message-ID <1325115169.5036.35.camel@samsung>
Hi,

I cannot reproduce the problem (using my quite recent GODI
installation). That EINPROGRESS "breaks out" is quite strange, because
the HTTP connection is made via Uq_engines.direct_connector, and there
it is caught.

A subtle problem I could imagine is that one of the libraries includes
unix.cma erroneously (i.e. the Unix module is defined twice), and
because of this there are two versions of Unix_error, and one cannot
catch this exception anymore. You could check this by running
ocamlobjinfo on the cma files, and looking whether a "Unit name" of Unix
occurs (should only be in unix.cma). (Btw: Do you see the problem also
for ocamlopt-compiled programs? cmxa's cannot be partially linked,
unlike cma's, so a linking problem is not possible.)

My versions are:

godi-atd-1.0.1godi1            Syntax for cross-language data types
godi-atdgen-1.2.2              Code generator for biniou and JSON serialization
godi-biniou-1.0.0godi1         Flexible binary data format
godi-easy-format-1.0.0godi1    Indentation made easy(ier)
godi-ocaml-3.12.1godi2         The core of the OCaml system (compiler, runtime)
godi-ocaml-src-3.12.1godi1     OCaml sources (required for GODI builds)
godi-ocaml-ssl-0.4.4godi2      The Secure Socket Layer
godi-ocamlnet-3.4.1            base library for network protocols
godi-ocamlnet-crypto-3.4.1     crypto extension for ocamlnet
godi-ocamlnet-ssl-3.4.1        SSL extension for ocamlnet
godi-pcre-6.2.3                Perl compatible regular expressions
godi-yojson-1.0.2godi1         JSON library succeeding to json-wheel

We can enable debugging. I get then:

# Http_client.Debug.enable := true;;
- : unit = ()
# Http_client.Convenience.http_get "http://perdu.com";;
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: HTTP connection: creating direct connection to perdu.com:80
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: FD 3 - HTTP direct connection to perdu.com:80: Connected!
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: HTTP Connection: adding call 74
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: Call 74: initialize transmitter
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: FD 3 - Call 74 - HTTP request: GET / HTTP/1.1
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: FD 3 - HTTP connection: Got Call 74!
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: FD 3 - HTTP connection: pipelining=true persistency=false close_connection=false->false
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: Call 74 - postprocessing
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: FD 3 - HTTP connection: Shutdown!
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: FD 3 - HTTP connection: Closing socket!
[Thu Dec 29 00:17:20 2011] [debug] [32146:0] Http_client: HTTP connection: checking remaining pipeline requests
- : string =
"<html><head><title>Vous Etes Perdu ?</title></head><body><h1>Perdu sur l'Internet ?</h1><h2>Pas de panique, on va vous aider</h2><strong><pre>    * <----- vous &ecirc;tes ici</pre></strong></body></html>\n"

Gerd

Am Freitag, den 23.12.2011, 16:11 +0100 schrieb Pierre-Alexandre Voye:
> Hi everyone,
> 
> I have just discovered a strange behavior of ocamlnet.
> 
> As i understood, it seems like if you load certain library together,
> the library is unable to make a simple http_get.
> I need to add these libs (particularly SSL), because i have to write a
> POST multipart https function.
> 
> Here an example with the toplevel which show the problem :
> (Sorry for the long long command)
> 
> 1. It works :-)
> 
> $ ocaml -I /opt/local/lib/ocaml/site-lib/pcre
> -I /opt/local/lib/ocaml/site-lib/netsys
> -I /opt/local/lib/ocaml/site-lib/netstring
> -I /opt/local/lib/ocaml/site-lib/netcgi2
> -I /opt/local/lib/ocaml/site-lib/equeue
> -I /opt/local/lib/ocaml/site-lib/netclient /opt/local/lib/ocaml/site-lib/pcre/pcre.cma /opt/local/lib/ocaml/unix.cma /opt/local/lib/ocaml/bigarray.cma /opt/local/lib/ocaml/site-lib/netsys/netsys_oothr.cma /opt/local/lib/ocaml/site-lib/netsys/netsys.cma /opt/local/lib/ocaml/site-lib/netstring/netstring.cma /opt/local/lib/ocaml/site-lib/netstring/netaccel.cma /opt/local/lib/ocaml/site-lib/netstring/netaccel_link.cmo /opt/local/lib/ocaml/site-lib/netcgi2/netcgi.cma /opt/local/lib/ocaml/site-lib/equeue/equeue.cma /opt/local/lib/ocaml/site-lib/netgssapi/netgssapi.cma /opt/local/lib/ocaml/site-lib/rpc/rpc.cma /opt/local/lib/ocaml/site-lib/netplex/netplex.cma /opt/local/lib/ocaml/site-lib/nethttpd/nethttpd.cma /opt/local/lib/ocaml/site-lib/netclient/netclient.cma
> 
>         Objective Caml version 3.12.1
> 
> # Http_client.Convenience.http_get "http://perdu.com";;
> - : string =
> "<html><head><title>Vous Etes Perdu ?</title></head><body><h1>Perdu
> sur l'Internet ?</h1><h2>Pas de panique, on va vous
> aider</h2><strong><pre>    * <----- vous &ecirc;tes
> ici</pre></strong></body></html>\n"
> 
> 
> 2. There's a problem !
> 
> ocaml -I /opt/local/lib/ocaml/site-lib/pcre
> -I /opt/local/lib/ocaml/site-lib/netsys
> -I /opt/local/lib/ocaml/site-lib/netstring
> -I /opt/local/lib/ocaml/site-lib/netcgi2
> -I /opt/local/lib/ocaml/site-lib/equeue
> -I /opt/local/lib/ocaml/site-lib/netgssapi
> -I /opt/local/lib/ocaml/site-lib/rpc
> -I /opt/local/lib/ocaml/site-lib/netplex
> -I /opt/local/lib/ocaml/site-lib/nethttpd
> -I /opt/local/lib/ocaml/site-lib/nethttpd-for-netcgi2
> -I /opt/local/lib/ocaml/site-lib/netclient
> -I /opt/local/lib/ocaml/site-lib/easy-format
> -I /opt/local/lib/ocaml/site-lib/atd
> -I /opt/local/lib/ocaml/site-lib/biniou
> -I /opt/local/lib/ocaml/site-lib/yojson
> -I /opt/local/lib/ocaml/site-lib/atdgen
> -I /opt/local/lib/ocaml/site-lib/ssl
> -I /opt/local/lib/ocaml/site-lib/equeue-ssl
> -I /opt/local/lib/ocaml/site-lib/rpc-ssl /opt/local/lib/ocaml/site-lib/pcre/pcre.cma /opt/local/lib/ocaml/unix.cma /opt/local/lib/ocaml/bigarray.cma /opt/local/lib/ocaml/site-lib/netsys/netsys_oothr.cma /opt/local/lib/ocaml/site-lib/netsys/netsys.cma /opt/local/lib/ocaml/site-lib/netstring/netstring.cma /opt/local/lib/ocaml/site-lib/netstring/netaccel.cma /opt/local/lib/ocaml/site-lib/netstring/netaccel_link.cmo /opt/local/lib/ocaml/site-lib/netcgi2/netcgi.cma /opt/local/lib/ocaml/site-lib/equeue/equeue.cma /opt/local/lib/ocaml/site-lib/netgssapi/netgssapi.cma /opt/local/lib/ocaml/site-lib/rpc/rpc.cma /opt/local/lib/ocaml/site-lib/netplex/netplex.cma /opt/local/lib/ocaml/site-lib/nethttpd/nethttpd.cma /opt/local/lib/ocaml/site-lib/netclient/netclient.cma /opt/local/lib/ocaml/str.cma /opt
 /local/lib/ocaml/site-lib/easy-format/easy_format.cmo /opt/local/lib/ocaml/site-lib/atd/atd.cma /opt/local/lib/ocaml/site-lib/biniou/biniou.cma /opt/local/lib/ocaml/site-lib/yojson/yojson.cmo /opt/local/lib/ocaml/site-lib/atdgen/atdgen.cma /opt/local/lib/ocaml/site-lib/ssl/ssl.cma /opt/local/lib/ocaml/site-lib/equeue-ssl/equeue_ssl.cma /opt/local/lib/ocaml/site-lib/rpc-ssl/rpc_ssl.cma         
> 
> Objective Caml version 3.12.1
> 
> # Http_client.Convenience.http_get "http://perdu.com";;
> Exception:
> Http_client.Http_protocol (Unix.Unix_error (Unix.EINPROGRESS,
> "connect", "")).
> 
> 
> So every http_call doesn't work, and of course https  with post verb.
> 
> is anayone have an idea ?
> 
> 
> 
> Merry Christmas to all !
> 
> 
> Pierre-Alexandre
> -- 
> ---------------------
> https://twitter.com/#!/ontologiae/
> http://linuxfr.org/users/montaigne
> 
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create 
> new or port existing apps to sell to consumers worldwide. Explore the 
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
> _______________________________________________ Ocamlnet-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel



------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox