You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@locus.apache.org on 2000/11/09 22:16:02 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http HttpResponseImpl.java

remm        00/11/09 13:16:02

  Modified:    catalina/src/share/org/apache/catalina/connector/http
                        HttpResponseImpl.java
  Log:
  - Important bug fix : When the output stream was never requested by the
    client, the content length wasn't properly set (and a end of response chunk
    wasn't generated either). The finishResponse method of HttpResponseImpl
    will now take care of that.
    Thanks (a lot) to Ray Allis for mentioning that some OPTIONS requests
    were causing timeouts problems in some DAV clients. Hopefully, that also
    fixes the compatibility issues with those clients.
  
  Revision  Changes    Path
  1.5       +27 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java
  
  Index: HttpResponseImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HttpResponseImpl.java	2000/11/09 20:15:50	1.4
  +++ HttpResponseImpl.java	2000/11/09 21:16:02	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java,v 1.4 2000/11/09 20:15:50 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/11/09 20:15:50 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java,v 1.5 2000/11/09 21:16:02 remm Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/11/09 21:16:02 $
    *
    * ====================================================================
    *
  @@ -78,7 +78,7 @@
    *
    * @author Craig R. McClanahan
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.4 $ $Date: 2000/11/09 20:15:50 $
  + * @version $Revision: 1.5 $ $Date: 2000/11/09 21:16:02 $
    */
   
   final class HttpResponseImpl
  @@ -243,6 +243,29 @@
                       headers.remove(name);
               }
   	}
  +
  +    }
  +
  +
  +    /**
  +     * Has stream been created ?
  +     */
  +    public boolean isStreamInitialized() {
  +        return (responseStream != null);
  +    }
  +
  +
  +    /**
  +     * Perform whatever actions are required to flush and close the output
  +     * stream or writer, in a single operation.
  +     *
  +     * @exception IOException if an input/output error occurs
  +     */
  +    public void finishResponse() throws IOException {
  +
  +        if (!isStreamInitialized())
  +            setContentLength(0);
  +        super.finishResponse();
   
       }