Mattias Lundstrom created CXF-4855:
--------------------------------------

             Summary: The server does not work with HTTP 1.0 clients 
(keep-alive not respected)
                 Key: CXF-4855
                 URL: https://issues.apache.org/jira/browse/CXF-4855
             Project: CXF
          Issue Type: Bug
          Components: Transports
    Affects Versions: 2.7.0
            Reporter: Mattias Lundstrom


The "Connection: keep-alive" handling for HTTP 1.0 clients do not seem to work 
in 2.7.x (tested on 2.7.0 and 2.7.3)
After some debugging in our system, the problem seems to be in the transport 
class org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java

This is a FilterOutputStream which means that calling close on this stream 
causes flush() + close() on the underlying stream. The problem is that the 
flush() call seem to cause response content length calculations to fail. This 
then causes the "Connection" response header to be filtered out (among other 
things).

We are currently running with our own local patch
=====
--- 
apache-cxf-2.7.0-src/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java.orig
      2012-10-06 04:19:50.000000000 +0200
+++ 
apache-cxf-2.7.0-src/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
   2013-02-11 14:59:21.411916187 +0100
@@ -405,6 +405,13 @@
             out.sendContent(c);
             return c.getCount();
         }
+
+        @Override
+        public void close() throws IOException {
+            // Avoid calling flush() here. It interferes with
+            // content length calculation in the generator.
+            out.close();
+        }
     }
     static class CountingInputStream extends FilterInputStream {
         int count;
=====

This seems to work in our system at least.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to