httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <>
Subject Patch to Apache 1.1b2 (fwd)
Date Sun, 28 Apr 1996 00:52:28 GMT

I know this has been discussed. Can someone who knows what
was decided, respond to this user please.

cc: Joseph Urban <>
Subject: Patch to Apache 1.1b2
Date: Sat, 27 Apr 1996 20:43:41 -0400
From: Kimmo Suominen <>

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <>

Dear Sirs,

On most SVR4/386 systems based on USL SVR4.0 there is a bug in the STREAMS
implementation of sockets.  When a socket is closed, any pending data will
be lost because the STREAMS structures holding the data are destroyed.  If
the SO_LINGER option is set on the socket with a long enough time, one can
usually avoid the problem.

I've attached the necessary patch below.  I use it on Dell SVR4 Issue 2.2,
but it is necessary for any issue of Dell SVR4, Esix, early UnixWare and
other USL SVR4.0/386 based systems.

I'm hoping you would include this patch in the release version of Apache.
I've submitted the same fix for 1.0.3 earlier.  I am not using the proxy
module, but if it has outbound sockets created, the same fix is needed in
all those places.  I would recommend writing a small function that returns
a socket with all the proper options set, and using that in all modules.

The Makefile flags I use are:

    AUX_LIBS= -lsocket -lnsl

Kimmo Suominen

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <>
Content-Description: Patch to src/http_main.c

Index: src/http_main.c
RCS file: /home/grendel/cvs/apache/src/http_main.c,v
retrieving revision
retrieving revision 1.3
diff -u -r1.1.1.2 -r1.3
--- http_main.c	1996/04/25 21:45:48
+++ http_main.c	1996/04/25 22:14:03	1.3
@@ -1240,16 +1240,31 @@
     if((setsockopt(s, SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(one)))
        == -1) {
-        perror("setsockopt");
-        fprintf(stderr,"httpd: could not set socket option\n");
+        perror("setsockopt(SO_REUSEADDR)");
+        fprintf(stderr,"httpd: could not set socket option SO_REUSEADDR\n");
     if((setsockopt(s, SOL_SOCKET,SO_KEEPALIVE,(char *)&keepalive_value,
         sizeof(keepalive_value))) == -1) {
-        perror("setsockopt"); 
+        perror("setsockopt(SO_KEEPALIVE)"); 
         fprintf(stderr,"httpd: could not set socket option SO_KEEPALIVE\n"); 
+#ifdef LINGER   /* If puts don't complete, you could try this. */
+    {
+	struct linger li;
+	li.l_onoff = 1;
+	li.l_linger = 900;
+	if (setsockopt(s, SOL_SOCKET, SO_LINGER,
+	    (char *)&li, sizeof(struct linger)) < 0) {
+	    perror("setsockopt(SO_LINGER)");
+	    fprintf(stderr,"httpd: could not set socket option SO_LINGER\n");
+	    exit(1);
+	}
+    }
+#endif  /* LINGER */
     if(bind(s, (struct sockaddr *)server,sizeof(struct sockaddr_in)) == -1)

------- =_aaaaaaaaaa0--

View raw message