ASF Bugzilla – Attachment 22092 Details for
Bug 45154
Support sendfile with NIO and SSL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for Tomcat 6.0.16
sendfileOverSSL.uplogix.patch (text/plain), 4.41 KB, created by
M McClain
on 2008-06-06 16:16:23 UTC
(
hide
)
Description:
Patch for Tomcat 6.0.16
Filename:
MIME Type:
Creator:
M McClain
Created:
2008-06-06 16:16:23 UTC
Size:
4.41 KB
patch
obsolete
>diff -aur apache-tomcat-6.0.16-src/java/org/apache/coyote/http11/Http11NioProcessor.java apache-tomcat-6.0.16-src.fixes/java/org/apache/coyote/http11/Http11NioProcessor.java >--- apache-tomcat-6.0.16-src/java/org/apache/coyote/http11/Http11NioProcessor.java 2008-01-28 16:41:12.000000000 -0600 >+++ apache-tomcat-6.0.16-src.fixes/java/org/apache/coyote/http11/Http11NioProcessor.java 2008-06-05 11:58:29.000000000 -0500 >@@ -908,6 +908,19 @@ > } > } > >+ boolean doBreak = false; >+ >+ // Do sendfile as needed: add socket to sendfile and end >+ if (sendfileData != null && !error) { >+ KeyAttachment ka = (KeyAttachment)socket.getAttachment(false); >+ ka.setSendfileData(sendfileData); >+ sendfileData.keepAlive = keepAlive; >+ SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector()); >+ //do the first write on this thread, might as well >+ openSocket = socket.getPoller().processSendfile(key,ka,true); >+ doBreak = true; >+ } >+ > // Finish the handling of the request > if (!comet) { > endRequest(); >@@ -925,18 +938,10 @@ > inputBuffer.nextRequest(); > outputBuffer.nextRequest(); > } >- >- // Do sendfile as needed: add socket to sendfile and end >- if (sendfileData != null && !error) { >- KeyAttachment ka = (KeyAttachment)socket.getAttachment(false); >- ka.setSendfileData(sendfileData); >- sendfileData.keepAlive = keepAlive; >- SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector()); >- //do the first write on this thread, might as well >- openSocket = socket.getPoller().processSendfile(key,ka,true); >- break; >- } > >+ if (doBreak) { >+ break; >+ } > > rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE); > >diff -aur apache-tomcat-6.0.16-src/java/org/apache/tomcat/util/net/NioEndpoint.java apache-tomcat-6.0.16-src.fixes/java/org/apache/tomcat/util/net/NioEndpoint.java >--- apache-tomcat-6.0.16-src/java/org/apache/tomcat/util/net/NioEndpoint.java 2008-01-28 16:41:14.000000000 -0600 >+++ apache-tomcat-6.0.16-src.fixes/java/org/apache/tomcat/util/net/NioEndpoint.java 2008-06-05 11:53:54.000000000 -0500 >@@ -30,6 +30,7 @@ > import java.nio.channels.Selector; > import java.nio.channels.ServerSocketChannel; > import java.nio.channels.SocketChannel; >+import java.nio.channels.WritableByteChannel; > import java.security.KeyStore; > import java.util.Collection; > import java.util.Iterator; >@@ -926,8 +927,7 @@ > } > > public boolean getUseSendfile() { >- //send file doesn't work with SSL >- return useSendfile && (!isSSLEnabled()); >+ return useSendfile; > } > > public int getOomParachute() { >@@ -1599,8 +1599,8 @@ > } > sd.fchannel = new FileInputStream(f).getChannel(); > } >- SocketChannel sc = attachment.getChannel().getIOChannel(); >- long written = sd.fchannel.transferTo(sd.pos,sd.length,sc); >+ WritableByteChannel writableByteChannel = attachment.getChannel(); >+ long written = sd.fchannel.transferTo(sd.pos,sd.length,writableByteChannel); > if ( written > 0 ) { > sd.pos += written; > sd.length -= written; >diff -aur apache-tomcat-6.0.16-src/java/org/apache/tomcat/util/net/SecureNioChannel.java apache-tomcat-6.0.16-src.fixes/java/org/apache/tomcat/util/net/SecureNioChannel.java >--- apache-tomcat-6.0.16-src/java/org/apache/tomcat/util/net/SecureNioChannel.java 2008-01-28 16:41:14.000000000 -0600 >+++ apache-tomcat-6.0.16-src.fixes/java/org/apache/tomcat/util/net/SecureNioChannel.java 2008-06-05 11:57:13.000000000 -0500 >@@ -399,8 +399,6 @@ > 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."); >
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 45154
: 22092