httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chuck Murcko <>
Subject UnixWare sockets patch - example
Date Tue, 07 May 1996 22:20:19 GMT
Ben Laurie liltingly intones:
> Chuck Murcko wrote:
> > 
> > 2) Imagemap files must contain absolute URLs, with FQDN, etc. for virtual
> >    hosts accessed my MSIE and Spry Mosaic. Netscape works OK.
> > 
I have MSIE to take home tonight and see if I can track this down on one
of our inside servers.
> >    ...
> > 
> > 4) Apache signal handling is still weird on some OS (IRIX, UnixWare).
> >    SIGTERM doesn't, occasionally. SIGHUP sometimes ends up in server
> >    terminating at log rollover time here, under BSDI. Partial work-
> >    around is the log rotation util in /support, but that doesn't help
> >    when reconfiguring servers.
> As I've said before, I suspect that switching to sigaction instead of signal
> may cure this ... shall I work up a patch?
By all means!

> > 
> > 5) UnixWare has broken socket library, which requires different options
> >    to get working.
> Patches?
Here's what's come in before (connection abstractions, anyone?):

Rob forwarded:

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--

Chuck Murcko	N2K Inc.	Wayne PA
And now, on a lighter note:
Aleph-null bottles of beer on the wall,
Aleph-null bottles of beer,
	You take one down, and pass it around,
Aleph-null bottles of beer on the wall.

View raw message