www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jon * <...@clearink.com>
Subject mod_jserv/5498: Pages being returned are empty
Date Mon, 20 Dec 1999 21:50:00 GMT
The following reply was made to PR mod_jserv/5498; it has been noted by GNATS.

From: jon * <jon@clearink.com>
To: <apbugs@apache.org>
Cc:  Subject: mod_jserv/5498: Pages being returned are empty
Date: Mon, 20 Dec 1999 13:48:06 -0800

 From: Michal Mosiewicz <mimo@interdata.com.pl>
 Reply-To: "Java Apache" <java-apache@list.working-dogs.com>
 Date: Mon, 20 Dec 1999 22:36:46 +0100
 To: Java Apache <java-apache@list.working-dogs.com>
 Subject: Re: FW: mod_jserv/5498: Pages being returned are empty
 jon * wrote:
 +1 on the patch. However the real reason that pages was empty was that
 the servlet author didn't close the output. So this patch actually
 closes the output for him, and corrects his mistake.
 > [...]
 > Why is this loop needed in the JServOutputStream close function?
 >         public void close() throws IOException {
 >             int l;
 >             do {
 >                 l = in.available();
 >                 in.skip(l);
 >             } while (l > 0);
 >             sendHttpHeaders();
 >             out.close();
 It's a "linger on close" feature.
 The loop is to protect that your data will be received by the browser
 even if you haven't received all the input stream. In case you have
 unread data waiting for being received in the socket, and you close the
 socket, depending on the operating system your output data that are
 buffered in the socket may get lost. Many OS'es assume "no SO_LINGER" as
 a default policy, setting socket options sometimes has no effect in
 JVM's. So this is safe way to go around this problem. AFAIK Costin
 suggested that calling available() is enough, but this seem to be safer.
 -- Mike
 To subscribe:        java-apache-on@list.working-dogs.com
 To unsubscribe:      java-apache-off@list.working-dogs.com
 Archives and Other:  <http://java.apache.org/main/mail.html>
 Problems?:           jon@working-dogs.com

View raw message