mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8276798: HttpURLConnection sends invalid HTTP request
Reviewed-by: dfuchs, michaelm
This commit is contained in:
parent
270cf67e5f
commit
50c37f53f2
1 changed files with 7 additions and 5 deletions
|
@ -626,10 +626,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||
* to last and last, respectively, in the case of a POST
|
||||
* request.
|
||||
*/
|
||||
if (!failedOnce) {
|
||||
final String requestLine = method + " " + getRequestURI()+ " " + httpVersion;
|
||||
final int requestLineIndex = requests.getKey(requestLine);
|
||||
if (requestLineIndex != 0) {
|
||||
// we expect the request line to be at index 0. we set it here
|
||||
// if we don't find the request line at that index.
|
||||
checkURLFile();
|
||||
requests.prepend(method + " " + getRequestURI()+" " +
|
||||
httpVersion, null);
|
||||
requests.prepend(requestLine, null);
|
||||
}
|
||||
if (!getUseCaches()) {
|
||||
requests.setIfNotSet ("Cache-Control", "no-cache");
|
||||
|
@ -656,8 +659,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||
* or if keep alive is disabled via a system property
|
||||
*/
|
||||
|
||||
// Try keep-alive only on first attempt
|
||||
if (!failedOnce && http.getHttpKeepAliveSet()) {
|
||||
if (http.getHttpKeepAliveSet()) {
|
||||
if (http.usingProxy && tunnelState() != TunnelState.TUNNELING) {
|
||||
requests.setIfNotSet("Proxy-Connection", "keep-alive");
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue