You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by jean-frederic clere <jf...@fujitsu-siemens.com> on 2002/02/08 18:10:45 UTC

Re: patch: fix warp connector to properly implement flush() and flushBuffer()

Roger Nesbitt wrote:
> 
> Hi all,
> 
> I've got a little servlet that keeps the HTTP connection streams data (html
> script data, to be precise) at the rate of a few bytes per second.  Tomcat
> handled this fine, but as soon as I routed it through Apache using the warp
> connector, I found that data was not sent until the connection was closed
> (never, in the case of my servlet.)
> 
> Traced the problem down to WarpResponse.java: for some reason it was
> inheriting its stream from OutputStream instead of ServletOutputStream,
> which was causing all sorts of problems.  Also made sure it flushed the
> headers before trying to write body data.
> 
> Seems to be going fine now, but this is my first patch so treat with
> caution!

I would propose another patch:
+++
--- catalina/src/share/org/apache/catalina/connector/ResponseBase.java  28 Sep
2001 23:34:02 -0000      1.19
+++ catalina/src/share/org/apache/catalina/connector/ResponseBase.java  8 Feb
2002 16:37:25 -0000
@@ -677,6 +677,7 @@
         if (bufferCount > 0) {
             try {
                 output.write(buffer, 0, bufferCount);
+                output.flush(); // otherwise does not work with mod_webapp ...
             } finally {
                 bufferCount = 0;
             }
+++
The code I have used to test is the following:

+++
ServletOutputStream out = response.getOutputStream();
out.println("<br>Jean-Frederic uses ServletOutputStream<br>");
out.flush();
+++

With the http connector it works without the output.flush()... But I have not
found why!

Any hints?

Cheers

Jean-frederic

> 
>  --
> Roger Nesbitt
> 
>   --------------------------------------------------------------------------------
>                             Name: warp-buffer-patch.txt
>    warp-buffer-patch.txt    Type: diff files (text/plain)
>                         Encoding: base64
> 
>   --------------------------------------------------------------------------------
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>