andrewgaul commented on this pull request.


> @@ -779,6 +782,22 @@ private static void addHeader(Multimap<String, String> 
> headers, Headers header,
       return parts.build();
    }
 
+   private static GeneratedHttpRequest 
stripExpectHeaderIfContentZero(GeneratedHttpRequest request) {
+      boolean isBodyEmpty = false;
+      if (request.getPayload() != null) {
+         Long length = 
request.getPayload().getContentMetadata().getContentLength();
+         if (length != null && length == 0) {
+            isBodyEmpty = true;
+         }
+      } else {
+         isBodyEmpty = true;
+      }

I tested removing Content-Length from 
`BaseBlobIntegrationTest.testPutInputStream` and found:

requires C-L:

* Atmos
* AWS-S3, 
[reference](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html)
* Azure Blob, 
[reference](https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob)
* B2, [reference](https://www.backblaze.com/b2/docs/b2_upload_file.html)

requires C-L but should not:

* GCS, 
[reference](https://cloud.google.com/storage/docs/json_api/v1/objects/insert)

does not require C-L but should:

* Rackspace Cloud Files/OpenStack Swift, 
[reference](https://developer.openstack.org/api-ref/object-storage/?expanded=create-or-replace-object-detail#create-or-replace-object)

I do not understand jclouds chunked encoding support well enough to comment but 
otherwise our portable call sites should set Content-Length.  For what it is 
worth I prefer the original code which does not assume a Content-Length and not 
the suggested change.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1120#discussion_r128358733

Reply via email to