Re: Trouble with httpGate and FreeBSD 9.1 [So

2013-02-04 Thread Mansur Mamkin
Hi Alex,
I've just tested app/main.l + httpGate with fresh development release, it works 
fine.
My patches to httpGate and ssl:
# diff -u httpGate.c.orig httpGate.c 
--- httpGate.c.orig 2012-03-20 12:46:41.0 +0600
+++ httpGate.c  2013-01-27 22:16:09.0 +0600
@@ -2,6 +2,7 @@
  * (c) Software Lab. Alexander Burger
  */
 
+#include sys/socket.h
 #include stdio.h
 #include stdlib.h
 #include unistd.h
@@ -15,6 +16,7 @@
 #include sys/stat.h
 #include netdb.h
 #include arpa/inet.h
+#include netinet/in.h
 
 #include openssl/pem.h
 #include openssl/ssl.h

 # diff -u ssl.c.orig ssl.c 
--- ssl.c.orig  2011-10-22 20:29:48.0 +0600
+++ ssl.c   2013-01-27 22:13:04.0 +0600
@@ -2,6 +2,7 @@
  * (c) Software Lab. Alexander Burger
  */
 
+#include sys/socket.h
 #include stdio.h
 #include stdlib.h
 #include unistd.h

Best regards,
Mansur

 Hi all,
 
 finally, after hours of tracing and debugging, Mansur and I could locate
 the problem!
 
 We found that the socket was unexpectedly in non-blocking mode, causing
 the read operation to return nonsense data.
 
 It resulted from the fact that new sockets returned from accept() in BSD
 inherit the flags from the parent socket. From the man page:
 
On Linux, the new socket returned by accept() does not inherit file
status flags such as O_NONBLOCK and O_ASYNC from the listening
socket. This behavior differs from the canonical BSD sockets
implementation. Portable programs should not rely on inheritance or
noninheritance of file status flags and always explicitly set all
required flags on the socket returned from accept().
 
 Because PicoLisp temporarily sets the socket to non-blocking before
 calling accept(), this was inherited to the new socket on FreeBSD (but
 not on Linux).
 
 Released a new version (3.1.1.10) to the repo, and -- as ever -- to
 http://software-lab.de/picoLisp.tgz
 
 ♪♫ Alex
 -- 
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
 

-- 


Re: Trouble with httpGate and FreeBSD 9.1 [So

2013-02-04 Thread Alexander Burger
Hi Mansur,

 I've just tested app/main.l + httpGate with fresh development release, it 
 works fine.

Again, many thanks for the help!


 My patches to httpGate and ssl:
 ...
 +#include sys/socket.h
 ...
 +#include netinet/in.h

OK. As these are just additional include files, I've also added them to
the release (same as before in src/net.c, according to your
suggestion). They work like that also in Linux.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe