You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by GitBox <gi...@apache.org> on 2022/06/03 15:17:55 UTC

[GitHub] [libcloud] KatiRG opened a new issue, #1703: scheme is hard-coded as http when converting response in azure_blobs

KatiRG opened a new issue, #1703:
URL: https://github.com/apache/libcloud/issues/1703

   ## Summary
   Functions `_response_to_container()` and `_response_to_object()` in class `AzureBlobsStorageDriver` of [azure_blobs](https://libcloud.readthedocs.io/en/stable/_modules/libcloud/storage/drivers/azure_blobs.html) hard-code the URL scheme to `http` in their `extra` objects, i.e.:
   ```
   extra = { "url": "http://%s%s" % (response.connection.host, response.connection.action),
   ```
   
   This will cause a request to download from Azure blob storage to fail if the storage URL is secure (i.e. uses `https`).
   
   ## Detailed Information
   Other functions in this class do check `secure` to dynamically assign the `scheme`, e.g. in `get_object_cdn_url()`:
   
   ```
   scheme="https" if self.secure else "http",
   ```
   We can fix the bug in the response functions in a similar way by dynamically assigning the scheme in the `extra` objects:
   
   ```
   scheme='https' if self.secure else 'http',
           extra = {
               'url': '%s://%s%s' % (scheme, response.connection.host,
                                       response.connection.action),
   ```
   
   
   ### Environment
   **Libcloud version**: apache-libcloud==2.8.2
   **Python version**: Python 3.8.10
   **Operating System**: Ubuntu 20.04 LTS
   
   **Steps which are needed to reproduce problem**:
   I am using a secure blob storage account (i.e. its URL starts with `https`) for a [CKAN](https://ckan.org/) project, version 2.9.
   
   I am using `AzureBlobsStorageDriver` with the CKAN extension [ckanext-cloudstorage](https://github.com/TkTech/ckanext-cloudstorage), an extension that requires libcloud, and the extension [ckanext-xloader](https://github.com/ckan/ckanext-xloader) (v 0.9.0), which accesses the blob storage account. Because of the bug reported here, Xloader is being passed an incorrect URL (starting with `http` instead of `https`), and therefore cannot download any data from the storage account:
   
   ```
   ckanext.xloader.job_exceptions.HTTPError: b'Xloader received a bad HTTP response when trying to download the data file 
   Client Error: The account being accessed does not support http.
   ```
   But with the fix to dynamically assign the scheme based on `secure`, the correct URL is passed and the data can be downloaded.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [libcloud] Kami closed issue #1703: scheme is hard-coded as http when converting response in azure_blobs

Posted by GitBox <gi...@apache.org>.
Kami closed issue #1703: scheme is hard-coded as http when converting response in azure_blobs
URL: https://github.com/apache/libcloud/issues/1703


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [libcloud] Kami commented on issue #1703: scheme is hard-coded as http when converting response in azure_blobs

Posted by GitBox <gi...@apache.org>.
Kami commented on issue #1703:
URL: https://github.com/apache/libcloud/issues/1703#issuecomment-1146873222

   Proposed change sounds good - please feel free to open a PR with that change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org