You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/08/23 15:35:55 UTC
svn commit: r1516845 - in /tomcat/trunk/java/org/apache/coyote/http11:
InternalAprOutputBuffer.java InternalNioOutputBuffer.java
LocalStrings.properties
Author: markt
Date: Fri Aug 23 13:35:54 2013
New Revision: 1516845
URL: http://svn.apache.org/r1516845
Log:
Reviewing NIO vs APR investigating unit test failure on Linux and OSX
Align code. Consistently generate an error message if a write of a 100 continue response fails
Modified:
tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties
Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1516845&r1=1516844&r2=1516845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Fri Aug 23 13:35:54 2013
@@ -123,14 +123,11 @@ public class InternalAprOutputBuffer ext
* Send an acknowledgment.
*/
@Override
- public void sendAck()
- throws IOException {
-
+ public void sendAck() throws IOException {
if (!committed) {
if (Socket.send(socket, Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length) < 0)
- throw new IOException(sm.getString("iib.failedwrite"));
+ throw new IOException(sm.getString("iob.failedwrite.ack"));
}
-
}
Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=1516845&r1=1516844&r2=1516845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Fri Aug 23 13:35:54 2013
@@ -68,8 +68,18 @@ public class InternalNioOutputBuffer ext
*/
protected volatile boolean flipped = false;
+
// --------------------------------------------------------- Public Methods
+ @Override
+ public void init(SocketWrapper<NioChannel> socketWrapper,
+ AbstractEndpoint endpoint) throws IOException {
+
+ socket = socketWrapper.getSocket();
+ pool = ((NioEndpoint)endpoint).getSelectorPool();
+ }
+
+
/**
* Recycle the output buffer. This should be called when closing the
* connection.
@@ -95,7 +105,10 @@ public class InternalNioOutputBuffer ext
if (!committed) {
socket.getBufHandler().getWriteBuffer().put(
Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length);
- writeToSocket(socket.getBufHandler().getWriteBuffer(), true, true);
+ int result = writeToSocket(socket.getBufHandler().getWriteBuffer(), true, true);
+ if (result < 0) {
+ throw new IOException(sm.getString("iob.failedwrite.ack"));
+ }
}
}
@@ -147,23 +160,13 @@ public class InternalNioOutputBuffer ext
// ------------------------------------------------------ Protected Methods
- @Override
- public void init(SocketWrapper<NioChannel> socketWrapper,
- AbstractEndpoint endpoint) throws IOException {
-
- socket = socketWrapper.getSocket();
- pool = ((NioEndpoint)endpoint).getSelectorPool();
- }
-
-
/**
* Commit the response.
*
* @throws IOException an underlying I/O error occurred
*/
@Override
- protected void commit()
- throws IOException {
+ protected void commit() throws IOException {
// The response is now committed
committed = true;
Modified: tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties?rev=1516845&r1=1516844&r2=1516845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties Fri Aug 23 13:35:54 2013
@@ -37,5 +37,6 @@ iib.parseheaders.ise.error=Unexpected st
iib.requestheadertoolarge.error=Request header is too large
iib.socketClosed=The socket has been closed in another thread
+iob.failedwrite.ack=Failed to send HTTP 100 continue response
iob.illegalreset=The response may not be reset once it has been committed
iob.responseheadertoolarge.error=An attempt was made to write more data to the response headers than there was room available in the buffer. Increase maxHttpHeaderSize on the connector or write less data into the response headers.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org