8291638: Keep-Alive timeout of 0 should close connection immediately

Reviewed-by: dfuchs, jpai
This commit is contained in:
Michael McMahon 2022-10-13 08:32:48 +00:00
parent 6ae7e4d4aa
commit 26ac836636
4 changed files with 32 additions and 11 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package sun.net.www;
import java.util.Iterator;
import java.util.OptionalInt;
/* This is useful for the nightmare of parsing multi-part HTTP/RFC822 headers
* sensibly:
@ -246,6 +247,19 @@ public class HeaderParser {
return Default;
}
}
public OptionalInt findInt(String k) {
try {
String s = findValue(k);
if (s == null) {
return OptionalInt.empty();
}
return OptionalInt.of(Integer.parseInt(s));
} catch (Throwable t) {
return OptionalInt.empty();
}
}
/*
public static void main(String[] a) throws Exception {
System.out.print("enter line to parse> ");