mirror of https://github.com/apache/jclouds.git
HttpUrlConnection reverts Content-Length=0 on POST unless doOutput is set to true
This commit is contained in:
parent
a7dc94ea77
commit
cd79a9d876
|
@ -231,6 +231,11 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
|
||||||
protected void writeNothing(HttpURLConnection connection) {
|
protected void writeNothing(HttpURLConnection connection) {
|
||||||
if (!HttpRequest.NON_PAYLOAD_METHODS.contains(connection.getRequestMethod())) {
|
if (!HttpRequest.NON_PAYLOAD_METHODS.contains(connection.getRequestMethod())) {
|
||||||
connection.setRequestProperty(CONTENT_LENGTH, "0");
|
connection.setRequestProperty(CONTENT_LENGTH, "0");
|
||||||
|
// support zero length posts.
|
||||||
|
if ("POST".equals(connection.getRequestMethod())) {
|
||||||
|
connection.setFixedLengthStreamingMode(0);
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue