mirror of https://github.com/apache/jclouds.git
Emit Content-Length: 0 for empty PUTs
HttpUrlConnection reverts Content-Length: 0 on PUT without doOutput(true), similar to POST. This commit allows Azure container create to succeed. Closes #1420.
This commit is contained in:
parent
f0a1054958
commit
843ed57c8a
|
@ -231,8 +231,9 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
|
|||
protected void writeNothing(HttpURLConnection connection) {
|
||||
if (!HttpRequest.NON_PAYLOAD_METHODS.contains(connection.getRequestMethod())) {
|
||||
connection.setRequestProperty(CONTENT_LENGTH, "0");
|
||||
// support zero length posts.
|
||||
if ("POST".equals(connection.getRequestMethod())) {
|
||||
// HttpUrlConnection strips Content-Length: 0 without setDoOutput(true)
|
||||
String method = connection.getRequestMethod();
|
||||
if ("POST".equals(method) || "PUT".equals(method)) {
|
||||
connection.setFixedLengthStreamingMode(0);
|
||||
connection.setDoOutput(true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue