[ 
https://issues.apache.org/jira/browse/LIBCLOUD-396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13765436#comment-13765436
 ] 

Tomaz Muraus commented on LIBCLOUD-396:
---------------------------------------

[~sfriesel] ah, you are correct, thanks. Storage driver does that because it 
uses "raw" mode where only headers are sent first and data is sent later.

Thanks and a good catch.

In this case the patch looks good, but it needs some test cases before it can 
be merged. We already have some tests for this functionality 
(https://github.com/apache/libcloud/blob/trunk/libcloud/test/test_connection.py#L37)
 so it should be fairly easy to add additional ones.

I'd also rather do "if method.upper() in ['POST', 'PUT'] and 'Content-Length' 
in headers" since it's more obvious what is going one compared to the set 
efault method.

Please also add a comment to the this code which sums up a discussion from this 
ticket so other people looking at the code will know why we (need to) do this.
                
> Commit c10249d1d733ba5215820c5d935265de5ae6bc84 break SWIFT storage
> -------------------------------------------------------------------
>
>                 Key: LIBCLOUD-396
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-396
>             Project: Libcloud
>          Issue Type: Bug
>          Components: Storage
>    Affects Versions: 0.13.1
>            Reporter: Ivan
>         Attachments: 0001-Set-Content-Length-to-0-only-if-it-is-not-set.patch
>
>
> Commit c10249d1d733ba5215820c5d935265de5ae6bc84 break SWIFT storage 
> (Provider.CLOUDFILES_SWIFT).
> The commit sets the Content-Length to 0 which can overwrite the existing 
> content length (in libcloud/common/base.py).
> The proposed fix: set the length to 0 only if it is not already set.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to