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

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

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


##########
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:
   > If maxKeepAliveRequests is `-1` then set `max` to Integer.MAX_VALUE
   
   I haven't found any RFC documents about how to response this parameter if no limit on server.
   I think personally that if we don't limit the number of request on the connection. We should ignore this parameter, and leave it up to the client to decide how to handle this connection (e.g. use their default strategy). In additional, that's how **httpd** handles it if I read correct.
   
   https://github.com/apache/httpd/blob/d62d3143f42771a7111c2148837c0a91a271b83d/modules/http/http_protocol.c#L287-L299



-- 
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