You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ha...@hyperreal.com> on 1996/02/25 10:56:12 UTC
Problematic sockets (fwd)
acked.
Forwarded message:
> From kim@tac.nyc.ny.us Sat Feb 24 18:32:22 1996
> Message-Id: <19...@grendel.gw.com>
> To: apache-bugs@apache.org
> Subject: Problematic sockets
> X-Face: dJ`"\|-Z6bKup3nm*Th75RV`!T)~xXMZKQt6|%BR~9'A7WzN"rsq4Cv+T~Hg9YRb^oEmVxz
> I0s1&A|(:ISoQJus6s<%pssRki3x*Kf;3BL;Gyq3'>06R>R`Om_ILkJAizKL{AC::|UE/N)u}*Ix}s
> nn{eh=0Um[!yF@gn-JN.6AB+xy5$Biy5I?)T~i#-C^m>vy(!(S*'m}M[>5uvbWcm
> MIME-Version: 1.0
> Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
> Content-ID: <11...@grendel.gw.com>
> Date: Sat, 24 Feb 1996 21:32:15 -0500
> From: Kimmo Suominen <ki...@tac.nyc.ny.us>
>
> ------- =_aaaaaaaaaa0
> Content-Type: text/plain; charset="us-ascii"
> Content-ID: <11...@grendel.gw.com>
>
> Hi!
>
> I just switched over to Apache at http://www.tac.nyc.ny.us/ and
> I am very happy with the server.
>
> There were two modifications I needed to make.
>
> I run:
> - Dell SVR4 Issue 2.2
> - Apache 1.0.3
> - gcc 2.4.5
>
> Many USL SVR4 -based systems might still experience from a broken
> implementation of sockets on top of STREAMS. The problem is that
> when a socket is closed, all the buffers are destroyed whether all
> the data in them has been transmitted or not. The result is that
> your pages are truncated -- not nice.
>
> Setting SO_LINGER on the socket helps. I've applied a "standard"
> fix on http_main.c to do this. Please see the attached patch.
>
> There was also a bug with mod_imap.c, where the gopher-scheme was
> not accounted for. Of course I happened to have that in one of
> my maps.
>
> Cheers,
> + Kim
>
> ------- =_aaaaaaaaaa0
> Content-Type: text/plain; charset="us-ascii"
> Content-ID: <11...@grendel.gw.com>
> Content-Description: Patch to Apache 1.0.3 src/
>
> Index: http_main.c
> ===================================================================
> RCS file: /home/grendel/cvs/apache/src/http_main.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 http_main.c
> --- http_main.c 1996/02/25 00:20:19 1.1.1.1
> +++ http_main.c 1996/02/25 01:14:07
> @@ -923,7 +923,7 @@
>
> if((setsockopt(sd,SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(one)))
> == -1) {
> - fprintf(stderr,"httpd: could not set socket option\n");
> + fprintf(stderr,"httpd: could not set socket option SO_REUSEADDR\n");
> perror("setsockopt");
> exit(1);
> }
> @@ -933,6 +933,21 @@
> perror("setsockopt");
> exit(1);
> }
> +
> +#ifdef LINGER /* If puts don't complete, you could try this. */
> + {
> + struct linger li;
> + li.l_onoff = 1;
> + li.l_linger = 900;
> +
> + if (setsockopt(sd, SOL_SOCKET, SO_LINGER,
> + (char *)&li, sizeof(struct linger)) < 0) {
> + fprintf(stderr,"httpd: could not set socket option SO_LINGER\n");
> + perror("setsockopt(SO_LINGER)");
> + exit(1);
> + }
> + }
> +#endif /* LINGER */
>
> memset((char *) &sa_server, 0, sizeof(sa_server));
> sa_server.sin_family=AF_INET;
> Index: mod_imap.c
> ===================================================================
> RCS file: /home/grendel/cvs/apache/src/mod_imap.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 mod_imap.c
> --- mod_imap.c 1996/02/25 00:20:20 1.1.1.1
> +++ mod_imap.c 1996/02/25 02:05:22
> @@ -210,6 +210,7 @@
> }
>
> if ((!strncmp (mapurl, "http:", 5 )) ||
> + !strncmp (mapurl, "gopher:", 7) ||
> !strncmp (mapurl, "mailto:", 7) ||
> !strncmp (mapurl, "ftp:", 4) ||
> !strncmp (mapurl, "telnet:", 7) ||
>
> ------- =_aaaaaaaaaa0--
>