View | Details | Raw Unified | Return to bug 45154
Collapse All | Expand All

(-)apache-tomcat-6.0.16-src/java/org/apache/coyote/http11/Http11NioProcessor.java (-11 / +16 lines)
Lines 908-913 Link Here
908
                }
908
                }
909
            }
909
            }
910
910
911
            boolean doBreak = false;
912
913
            // Do sendfile as needed: add socket to sendfile and end
914
            if (sendfileData != null && !error) {
915
                KeyAttachment ka = (KeyAttachment)socket.getAttachment(false);
916
                ka.setSendfileData(sendfileData);
917
                sendfileData.keepAlive = keepAlive;
918
                SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
919
                //do the first write on this thread, might as well
920
                openSocket = socket.getPoller().processSendfile(key,ka,true);
921
                doBreak = true;
922
            }
923
911
            // Finish the handling of the request
924
            // Finish the handling of the request
912
            if (!comet) {
925
            if (!comet) {
913
                endRequest();
926
                endRequest();
Lines 925-942 Link Here
925
                inputBuffer.nextRequest();
938
                inputBuffer.nextRequest();
926
                outputBuffer.nextRequest();
939
                outputBuffer.nextRequest();
927
            }
940
            }
928
            
929
            // Do sendfile as needed: add socket to sendfile and end
930
            if (sendfileData != null && !error) {
931
                KeyAttachment ka = (KeyAttachment)socket.getAttachment(false);
932
                ka.setSendfileData(sendfileData);
933
                sendfileData.keepAlive = keepAlive;
934
                SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
935
                //do the first write on this thread, might as well
936
                openSocket = socket.getPoller().processSendfile(key,ka,true);
937
                break;
938
            }
939
941
942
            if (doBreak) {
943
              break;
944
            }
940
945
941
            rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
946
            rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
942
947
(-)apache-tomcat-6.0.16-src/java/org/apache/tomcat/util/net/NioEndpoint.java (-4 / +4 lines)
Lines 30-35 Link Here
30
import java.nio.channels.Selector;
30
import java.nio.channels.Selector;
31
import java.nio.channels.ServerSocketChannel;
31
import java.nio.channels.ServerSocketChannel;
32
import java.nio.channels.SocketChannel;
32
import java.nio.channels.SocketChannel;
33
import java.nio.channels.WritableByteChannel;
33
import java.security.KeyStore;
34
import java.security.KeyStore;
34
import java.util.Collection;
35
import java.util.Collection;
35
import java.util.Iterator;
36
import java.util.Iterator;
Lines 926-933 Link Here
926
    }
927
    }
927
928
928
    public boolean getUseSendfile() {
929
    public boolean getUseSendfile() {
929
        //send file doesn't work with SSL
930
        return useSendfile;
930
        return useSendfile && (!isSSLEnabled());
931
    }
931
    }
932
932
933
    public int getOomParachute() {
933
    public int getOomParachute() {
Lines 1599-1606 Link Here
1599
                    }
1599
                    }
1600
                    sd.fchannel = new FileInputStream(f).getChannel();
1600
                    sd.fchannel = new FileInputStream(f).getChannel();
1601
                }
1601
                }
1602
                SocketChannel sc = attachment.getChannel().getIOChannel();
1602
                WritableByteChannel writableByteChannel = attachment.getChannel();
1603
                long written = sd.fchannel.transferTo(sd.pos,sd.length,sc);
1603
                long written = sd.fchannel.transferTo(sd.pos,sd.length,writableByteChannel);
1604
                if ( written > 0 ) {
1604
                if ( written > 0 ) {
1605
                    sd.pos += written;
1605
                    sd.pos += written;
1606
                    sd.length -= written;
1606
                    sd.length -= written;
(-)apache-tomcat-6.0.16-src/java/org/apache/tomcat/util/net/SecureNioChannel.java (-2 lines)
Lines 399-406 Link Here
399
            int written = sc.write(src);
399
            int written = sc.write(src);
400
            return written;
400
            return written;
401
        } else {
401
        } else {
402
            //make sure we can handle expand, and that we only use on buffer
403
            if ( src != bufHandler.getWriteBuffer() ) throw new IllegalArgumentException("You can only write using the application write buffer provided by the handler.");
404
            //are we closing or closed?
402
            //are we closing or closed?
405
            if ( closing || closed) throw new IOException("Channel is in closing state.");
403
            if ( closing || closed) throw new IOException("Channel is in closing state.");
406
404

Return to bug 45154