ASF Bugzilla – Attachment 21008 Details for
Bug 43653
NIO connector may corrupt first line of HTTP/1.1 100 Continue response
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Correct patch this time
patch.txt (text/plain), 4.68 KB, created by
Filip Hanik
on 2007-10-18 12:38:15 UTC
(
hide
)
Description:
Correct patch this time
Filename:
MIME Type:
Creator:
Filip Hanik
Created:
2007-10-18 12:38:15 UTC
Size:
4.68 KB
patch
obsolete
>Index: java/org/apache/tomcat/util/net/NioBlockingSelector.java >=================================================================== >--- java/org/apache/tomcat/util/net/NioBlockingSelector.java (revision 585602) >+++ java/org/apache/tomcat/util/net/NioBlockingSelector.java (working copy) >@@ -47,10 +47,6 @@ > boolean timedout = false; > int keycount = 1; //assume we can write > long time = System.currentTimeMillis(); //start the timeout timer >- if (socket.getBufHandler().getWriteBuffer() != buf) { >- socket.getBufHandler().getWriteBuffer().put(buf); >- buf = socket.getBufHandler().getWriteBuffer(); >- } > try { > while ( (!timedout) && buf.hasRemaining()) { > if (keycount > 0) { //only write if we were registered for a write >Index: java/org/apache/tomcat/util/net/NioSelectorPool.java >=================================================================== >--- java/org/apache/tomcat/util/net/NioSelectorPool.java (revision 585602) >+++ java/org/apache/tomcat/util/net/NioSelectorPool.java (working copy) >@@ -139,10 +139,6 @@ > boolean timedout = false; > int keycount = 1; //assume we can write > long time = System.currentTimeMillis(); //start the timeout timer >- if ( socket.getBufHandler().getWriteBuffer()!= buf ) { >- socket.getBufHandler().getWriteBuffer().put(buf); >- buf = socket.getBufHandler().getWriteBuffer(); >- } > try { > while ( (!timedout) && buf.hasRemaining() ) { > int cnt = 0; >Index: java/org/apache/tomcat/util/net/SecureNioChannel.java >=================================================================== >--- java/org/apache/tomcat/util/net/SecureNioChannel.java (revision 585602) >+++ java/org/apache/tomcat/util/net/SecureNioChannel.java (working copy) >@@ -392,38 +392,44 @@ > * @todo Implement this java.nio.channels.WritableByteChannel method > */ > public int write(ByteBuffer src) throws IOException { >- //make sure we can handle expand, and that we only use on buffer >- if ( src != bufHandler.getWriteBuffer() ) throw new IllegalArgumentException("You can only write using the application write buffer provided by the handler."); >- //are we closing or closed? >- if ( closing || closed) throw new IOException("Channel is in closing state."); >- >- //the number of bytes written >- int written = 0; >- >- if (!flush(netOutBuffer)) { >- //we haven't emptied out the buffer yet >+ if ( src == this.netOutBuffer ) { >+ //we can get here through a recursive call >+ //by using the NioBlockingSelector >+ int written = sc.write(src); > return written; >+ } else { >+ //make sure we can handle expand, and that we only use on buffer >+ if ( src != bufHandler.getWriteBuffer() ) throw new IllegalArgumentException("You can only write using the application write buffer provided by the handler."); >+ //are we closing or closed? >+ if ( closing || closed) throw new IOException("Channel is in closing state."); >+ >+ //the number of bytes written >+ int written = 0; >+ >+ if (!flush(netOutBuffer)) { >+ //we haven't emptied out the buffer yet >+ return written; >+ } >+ >+ /* >+ * The data buffer is empty, we can reuse the entire buffer. >+ */ >+ netOutBuffer.clear(); >+ >+ SSLEngineResult result = sslEngine.wrap(src, netOutBuffer); >+ written = result.bytesConsumed(); >+ netOutBuffer.flip(); >+ >+ if (result.getStatus() == Status.OK) { >+ if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks(); >+ } else { >+ throw new IOException("Unable to wrap data, invalid engine state: " +result.getStatus()); >+ } >+ >+ //force a flush >+ flush(netOutBuffer); >+ return written; > } >- >- /* >- * The data buffer is empty, we can reuse the entire buffer. >- */ >- netOutBuffer.clear(); >- >- SSLEngineResult result = sslEngine.wrap(src, netOutBuffer); >- written = result.bytesConsumed(); >- netOutBuffer.flip(); >- >- if (result.getStatus() == Status.OK) { >- if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks(); >- } else { >- throw new IOException("Unable to wrap data, invalid engine state: " +result.getStatus()); >- } >- >- //force a flush >- flush(netOutBuffer); >- >- return written; > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 43653
:
21006
|
21007
|
21008
|
21012
|
21015