[
https://issues.apache.org/jira/browse/LIBCLOUD-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15951955#comment-15951955
]
ASF GitHub Bot commented on LIBCLOUD-901:
-----------------------------------------
Github user asfgit closed the pull request at:
https://github.com/apache/libcloud/pull/1006
> 4xx and 5xx HTTP status codes are silently masked as 200
> --------------------------------------------------------
>
> Key: LIBCLOUD-901
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-901
> Project: Libcloud
> Issue Type: Bug
> Reporter: Richard Xia
>
> I'm seeing this on the latest trunk as well as v2.0.0rc1-tentative. When I
> try to upload an object to AWS S3 using the {{upload_object_via_stream}}
> method and there is an error (I'll create a separate ticket for that, which
> I've also determined the cause of), {{libcloud}} will ignore the 5xx error
> response from {{requests}} and set the status to the default of 200.
> The reason this occurs is because the constructor of {{RawResponse}} has an
> optional argument {{response}} which has a default value of {{None}}. The
> body of the constructor checks [{{if
> response}}|https://github.com/apache/libcloud/blob/516018d050a5470afe4a07d33d1fcb26d0e1df18/libcloud/common/base.py#L285]
> to check if a response was passed into the constructor, but it turns out
> that the {{requests}} library [overloads the {{__nonzero__}}/{{__bool__}}
> methods|https://github.com/kennethreitz/requests/issues/2002] to return
> {{False}} if the response status code is 4xx or 5xx. This [has been
> fixed|https://github.com/kennethreitz/requests/pull/2587] in the 3.0 branch
> of {{requests}}, but version 3.0 hasn't been released yet, so this currently
> affects all versions of requests.
> I will submit a pull request with the small change to fix this.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)