You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2017/11/03 13:23:29 UTC

svn commit: r1814181 - in /tomcat/trunk: java/org/apache/coyote/http2/Http2Protocol.java java/org/apache/coyote/http2/Stream.java webapps/docs/config/http2.xml

Author: remm
Date: Fri Nov  3 13:23:29 2017
New Revision: 1814181

URL: http://svn.apache.org/viewvc?rev=1814181&view=rev
Log:
Add a useSendfile attribute for HTTP/2.

Modified:
    tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java
    tomcat/trunk/java/org/apache/coyote/http2/Stream.java
    tomcat/trunk/webapps/docs/config/http2.xml

Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java?rev=1814181&r1=1814180&r2=1814181&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java Fri Nov  3 13:23:29 2017
@@ -70,6 +70,7 @@ public class Http2Protocol implements Up
     private int maxTrailerCount = Constants.DEFAULT_MAX_TRAILER_COUNT;
     private int maxTrailerSize = Constants.DEFAULT_MAX_TRAILER_SIZE;
     private boolean initiatePingDisabled = false;
+    private boolean useSendfile = true;
 
     @Override
     public String getHttpUpgradeName(boolean isSSLEnabled) {
@@ -189,6 +190,16 @@ public class Http2Protocol implements Up
     }
 
 
+    public boolean getUseSendfile() {
+        return useSendfile;
+    }
+
+
+    public void setUseSendfile(boolean useSendfile) {
+        this.useSendfile = useSendfile;
+    }
+
+
     public void setAllowedTrailerHeaders(String commaSeparatedHeaders) {
         // Jump through some hoops so we don't end up with an empty set while
         // doing updates.

Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1814181&r1=1814180&r2=1814181&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Fri Nov  3 13:23:29 2017
@@ -104,7 +104,7 @@ class Stream extends AbstractStream impl
             // TODO Assuming the body has been read at this point is not valid
             state.receivedEndOfStream();
         }
-        this.coyoteRequest.setSendfile(handler.hasAsyncIO());
+        this.coyoteRequest.setSendfile(handler.hasAsyncIO() && handler.getProtocol().getUseSendfile());
         this.coyoteResponse.setOutputBuffer(outputBuffer);
         this.coyoteRequest.setResponse(coyoteResponse);
         this.coyoteRequest.protocol().setString("HTTP/2.0");

Modified: tomcat/trunk/webapps/docs/config/http2.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/http2.xml?rev=1814181&r1=1814180&r2=1814181&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/http2.xml (original)
+++ tomcat/trunk/webapps/docs/config/http2.xml Fri Nov  3 13:23:29 2017
@@ -146,6 +146,11 @@
       <code>10000</code> will be used.</p>
     </attribute>
 
+    <attribute name="useSendfile" required="false">
+      <p>Use this boolean attribute to enable or disable sendfile capability.
+      The default value is <code>true</code>.</p>
+    </attribute>
+
     <attribute name="writeTimeout" required="false">
       <p>The time, in milliseconds, that Tomcat will wait to write additional
       data when an HTTP/2 frame has been partially written. Negative values will



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