mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-19 01:47:52 +00:00
6952017: HttpURLConnection chunked encoding issue (Http request splitting)
Reviewed-by: chegar
This commit is contained in:
parent
05153d7e82
commit
3dde10558a
@ -463,9 +463,12 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
"application/x-www-form-urlencoded");
|
||||
}
|
||||
|
||||
boolean chunked = false;
|
||||
|
||||
if (streaming()) {
|
||||
if (chunkLength != -1) {
|
||||
requests.set ("Transfer-Encoding", "chunked");
|
||||
chunked = true;
|
||||
} else { /* fixed content length */
|
||||
if (fixedContentLengthLong != -1) {
|
||||
requests.set ("Content-Length",
|
||||
@ -485,6 +488,16 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
}
|
||||
}
|
||||
|
||||
if (!chunked) {
|
||||
if (requests.findValue("Transfer-Encoding") != null) {
|
||||
requests.remove("Transfer-Encoding");
|
||||
if (logger.isLoggable(PlatformLogger.WARNING)) {
|
||||
logger.warning(
|
||||
"use streaming mode for chunked encoding");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get applicable cookies based on the uri and request headers
|
||||
// add them to the existing request headers
|
||||
setCookieHeader();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user