8291637: HttpClient default keep alive timeout not followed if server sends invalid value

Reviewed-by: jpai, dfuchs
This commit is contained in:
Michael McMahon 2022-08-05 14:51:58 +00:00
parent 0da4314e95
commit b17a745d7f
2 changed files with 147 additions and 0 deletions

View file

@ -900,7 +900,15 @@ public class HttpClient extends NetworkClient {
responses.findValue("Keep-Alive"));
/* default should be larger in case of proxy */
keepAliveConnections = p.findInt("max", usingProxy?50:5);
if (keepAliveConnections < 0) {
keepAliveConnections = usingProxy?50:5;
}
keepAliveTimeout = p.findInt("timeout", -1);
if (keepAliveTimeout < -1) {
// if the server specified a negative (invalid) value
// then we set to -1, which is equivalent to no value
keepAliveTimeout = -1;
}
}
} else if (b[7] != '0') {
/*