tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r375582 - in /tomcat/connectors/trunk: http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java jk/java/org/apache/coyote/ajp/AjpAprProcessor.java
Date Tue, 07 Feb 2006 11:47:24 GMT
Author: remm
Date: Tue Feb  7 03:47:20 2006
New Revision: 375582

URL: http://svn.apache.org/viewcvs?rev=375582&view=rev
Log:
- 38464: Fix incorrect usage of sendbb method, which can in some cases do incomplete writes.
  Let me know if there are still problems.
- Note: for AJP, the fix is there just-in-case, as it is apparently impossible to get in this
  situation.

Modified:
    tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
    tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java

Modified: tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=375582&r1=375581&r2=375582&view=diff
==============================================================================
--- tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
(original)
+++ tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
Tue Feb  7 03:47:20 2006
@@ -695,9 +695,14 @@
     protected void flushBuffer()
         throws IOException {
         if (bbuf.position() > 0) {
-            if (Socket.sendbb(socket, 0, bbuf.position()) < 0) {
-                throw new IOException(sm.getString("iib.failedwrite"));
-            }
+            int i = 0;
+            int n = 0;
+            do {
+                if ((n = Socket.sendbb(socket, i, bbuf.position())) < 0) {
+                    throw new IOException();
+                }
+                i += n;
+            } while (i < bbuf.position());
             bbuf.clear();
         }
     }

Modified: tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=375582&r1=375581&r2=375582&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/connectors/trunk/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java Tue Feb  7
03:47:20 2006
@@ -1169,9 +1169,14 @@
     protected void flush()
         throws IOException {
         if (outputBuffer.position() > 0) {
-            if (Socket.sendbb(socket, 0, outputBuffer.position()) < 0) {
-                throw new IOException(sm.getString("ajpprotocol.failedwrite"));
-            }
+            int i = 0;
+            int n = 0;
+            do {
+                if ((n = Socket.sendbb(socket, i, outputBuffer.position())) < 0) {
+                    throw new IOException();
+                }
+                i += n;
+            } while (i < outputBuffer.position());
             outputBuffer.clear();
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message