You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "babyblue94520 (via GitHub)" <gi...@apache.org> on 2023/08/10 01:08:55 UTC

[GitHub] [tomcat] babyblue94520 commented on a diff in pull request #645: feat(Http11Processor): Add max value in keepalive.

babyblue94520 commented on code in PR #645:
URL: https://github.com/apache/tomcat/pull/645#discussion_r1289412320


##########
java/org/apache/coyote/http11/Http11Processor.java:
##########
@@ -999,7 +999,12 @@ protected final void prepareResponse() throws IOException {
                     int keepAliveTimeout = protocol.getKeepAliveTimeout();
 
                     if (keepAliveTimeout > 0) {
-                        String value = "timeout=" + keepAliveTimeout / 1000L;
+                        StringBuilder value = new StringBuilder();
+                        value.append("timeout=").append(keepAliveTimeout / 1000L);
+                        int maxKeepAliveRequests = protocol.getMaxKeepAliveRequests();
+                        if (maxKeepAliveRequests > 0) {

Review Comment:
   How is this idea implemented here? Because it affects keepAliveLeft.
   
   [AbstractEndpoint](https://github.com/apache/tomcat/blob/main/java/org/apache/tomcat/util/net/AbstractEndpoint.java)
   ```
   public int getMaxKeepAliveRequests() {
       // Disable keep-alive if the server socket is not bound
       if (bindState.isBound()) {
           return maxKeepAliveRequests;
       } else {
           return 1;
       }
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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