You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by jf...@apache.org on 2011/07/19 10:06:47 UTC

svn commit: r1148216 - /tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java

Author: jfclere
Date: Tue Jul 19 08:06:46 2011
New Revision: 1148216

URL: http://svn.apache.org/viewvc?rev=1148216&view=rev
Log:
Fix for PR49595

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1148216&r1=1148215&r2=1148216&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Tue Jul 19 08:06:46 2011
@@ -507,13 +507,13 @@ public class AjpAprProcessor extends Abs
         long socketRef = socket.getSocket().longValue();
         
         if (outputBuffer.position() > 0) {
-            if (Socket.sendbb(socketRef, 0, outputBuffer.position()) < 0) {
+            if ((socketRef != 0) && Socket.sendbb(socketRef, 0, outputBuffer.position()) < 0) {
                 throw new IOException(sm.getString("ajpprocessor.failedsend"));
             }
             outputBuffer.clear();
         }
         // Send explicit flush message
-        if (explicit && !finished) {
+        if (explicit && !finished &&  (socketRef != 0)) {
             if (Socket.send(socketRef, flushMessageArray, 0,
                     flushMessageArray.length) < 0) {
                 throw new IOException(sm.getString("ajpprocessor.failedflush"));



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


Re: svn commit: r1148216 - /tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java

Posted by jean-frederic clere <jf...@gmail.com>.
On 07/21/2011 01:34 PM, Konstantin Kolinko wrote:
> 2011/7/19<jf...@apache.org>:
>> Author: jfclere
>> Date: Tue Jul 19 08:06:46 2011
>> New Revision: 1148216
>>
>> URL: http://svn.apache.org/viewvc?rev=1148216&view=rev
>> Log:
>> Fix for PR49595
>>
>> Modified:
>>     tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
>>
>
>> --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
>> +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Tue Jul 19 08:06:46 2011
>> @@ -507,13 +507,13 @@ public class AjpAprProcessor extends Abs
>>          long socketRef = socket.getSocket().longValue();
>>
>>          if (outputBuffer.position()>  0) {
>> -            if (Socket.sendbb(socketRef, 0, outputBuffer.position())<  0) {
>> +            if ((socketRef != 0)&&  Socket.sendbb(socketRef, 0, outputBuffer.position())<  0) {
>>                  throw new IOException(sm.getString("ajpprocessor.failedsend"));
>>              }
>>              outputBuffer.clear();
>
> 1. Shouldn't socketRef eq 0 result in IOException as well here and in
> the fragment below?

Probably.

> 2. I suspect that outputBuffer.clear() should be called even if
> IOException is thrown.

Yep

Cheers

Jean-Frederic

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


Re: svn commit: r1148216 - /tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/7/19  <jf...@apache.org>:
> Author: jfclere
> Date: Tue Jul 19 08:06:46 2011
> New Revision: 1148216
>
> URL: http://svn.apache.org/viewvc?rev=1148216&view=rev
> Log:
> Fix for PR49595
>
> Modified:
>    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
>

> --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
> +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Tue Jul 19 08:06:46 2011
> @@ -507,13 +507,13 @@ public class AjpAprProcessor extends Abs
>         long socketRef = socket.getSocket().longValue();
>
>         if (outputBuffer.position() > 0) {
> -            if (Socket.sendbb(socketRef, 0, outputBuffer.position()) < 0) {
> +            if ((socketRef != 0) && Socket.sendbb(socketRef, 0, outputBuffer.position()) < 0) {
>                 throw new IOException(sm.getString("ajpprocessor.failedsend"));
>             }
>             outputBuffer.clear();

1. Shouldn't socketRef eq 0 result in IOException as well here and in
the fragment below?
2. I suspect that outputBuffer.clear() should be called even if
IOException is thrown.

>         }
>         // Send explicit flush message
> -        if (explicit && !finished) {
> +        if (explicit && !finished &&  (socketRef != 0)) {
>             if (Socket.send(socketRef, flushMessageArray, 0,
>                     flushMessageArray.length) < 0) {
>                 throw new IOException(sm.getString("ajpprocessor.failedflush"));
>
>
>
> ---------------------------------------------------------------------


Best regards,
Konstantin Kolinko

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