mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8209178: Proxied HttpsURLConnection doesn't send BODY when retrying POST request
Preserve BODY in poster output stream before sending CONNECT request Reviewed-by: dfuchs, vtewari
This commit is contained in:
parent
8e98ce54bf
commit
82747fa960
2 changed files with 424 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2019, 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
|
||||
|
@ -707,11 +707,7 @@ public class HttpClient extends NetworkClient {
|
|||
} else {
|
||||
// try once more
|
||||
openServer();
|
||||
if (needsTunneling()) {
|
||||
MessageHeader origRequests = requests;
|
||||
httpuc.doTunneling();
|
||||
requests = origRequests;
|
||||
}
|
||||
checkTunneling(httpuc);
|
||||
afterConnect();
|
||||
writeRequests(requests, poster);
|
||||
return parseHTTP(responses, pi, httpuc);
|
||||
|
@ -722,6 +718,18 @@ public class HttpClient extends NetworkClient {
|
|||
|
||||
}
|
||||
|
||||
// Check whether tunnel must be open and open it if necessary
|
||||
// (in the case of HTTPS with proxy)
|
||||
private void checkTunneling(HttpURLConnection httpuc) throws IOException {
|
||||
if (needsTunneling()) {
|
||||
MessageHeader origRequests = requests;
|
||||
PosterOutputStream origPoster = poster;
|
||||
httpuc.doTunneling();
|
||||
requests = origRequests;
|
||||
poster = origPoster;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean parseHTTPHeader(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
|
||||
throws IOException {
|
||||
/* If "HTTP/*" is found in the beginning, return true. Let
|
||||
|
@ -849,11 +857,7 @@ public class HttpClient extends NetworkClient {
|
|||
closeServer();
|
||||
cachedHttpClient = false;
|
||||
openServer();
|
||||
if (needsTunneling()) {
|
||||
MessageHeader origRequests = requests;
|
||||
httpuc.doTunneling();
|
||||
requests = origRequests;
|
||||
}
|
||||
checkTunneling(httpuc);
|
||||
afterConnect();
|
||||
writeRequests(requests, poster);
|
||||
return parseHTTP(responses, pi, httpuc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue