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

Daniel Talsky commented on LIBCLOUD-851:
----------------------------------------

I'm having the same problem and have some additional information.  I send the 
following curl call and get the following error:

curl -i -X GET -H 'x-ms-version: 2012-02-12' -H 'Accept-Encoding: gzip,deflate' 
-H 'X-LC-Request-ID: 140216384132432' -H
'User-Agent: libcloud/2.0.0 (Microsoft Azure (blobs)) ' -H 'Authorization: 
SharedKey apachelibcloudpoc:eewguJMYguV5RCpj3V
doAQ69ZqUiXN5TGhPGmftC2qE=' -H 'x-ms-date: Wed, 21 Jun 2017 20:07:32 GMT' 
--compress 'https://apachelibcloudpoc.blob.core
.windows.net/?comp=list&include=metadata&maxresults=100'

{quote}
# -------- begin 140216384132432:140216384230288 response ----------
11 400 The value for one of the HTTP headers is not in the correct format.
Content-Length: 328
Content-Type: application/xml
Server: Microsoft-HTTPAPI/2.0
X-Ms-Request-Id: fec9d225-0001-0114-42ca-ea43fc000000
Date: Wed, 21 Jun 2017 20:07:31 GMT

<?xml version="1.0" 
encoding="utf-8"?><Error><Code>InvalidHeaderValue</Code><Message>The value for 
one of the HTTP header
s is not in the correct format.
RequestId:fec9d225-0001-0114-42ca-ea43fc000000
Time:2017-06-21T20:07:32.6852342Z</Message><HeaderName>x-ms-version</HeaderName><HeaderValue>2012-02-12</HeaderValue></Er
ror>{quote}

It took me a while but I found the following page on the Azure site:
https://docs.microsoft.com/en-us/rest/api/storageservices/azure-storage-services-versions-2015-07-08-and-earlier

Specifically:

{quote}
A request made via a SAS is processed according to which service version was 
used to generate the SAS. Versions 2013-08-15 and 2012-02-12 include a 
versioning parameter (SignedVersion, or sv), which specifies which version to 
use to authenticate and execute the SAS request.
Version 2012-02-12 and later

Requests with Shared Access Signatures (SAS) generated using version 2012-02-12 
or later require the SignedVersion (sv) parameter. SignedVersion indicates the 
service version used for authentication and authorization and for calling the 
API operation. If the x-ms-version header is passed on the request, it is 
ignored; only the SignedVersion (sv) parameter determines the service version 
to use to process the request made via the SAS{quote}

In other words, an sv= parameter needs to be added that matches the 
x-ms-version, and it's not optional for x-ms-version: 2012-02-12.

Thanks.

> Azure blob storage - Unable to list blobs of a container
> --------------------------------------------------------
>
>                 Key: LIBCLOUD-851
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-851
>             Project: Libcloud
>          Issue Type: Bug
>          Components: Storage
>         Environment: Debian GNU/Linux
>            Reporter: Antoine R. Dumont
>              Labels: blobstore, storage_drivers
>
> Hello,
> Trying to list the blobs of a container in an azure blob storage, the 
> instanciation step of a container systematically breaks with a 400 bad 
> request.
> I have not much details in the error message:
> {code:title=output|borderStyle=solid}
> Traceback (most recent call last):
>   File "./bin/basic-scenario", line 20, in <module>
>     container = driver.get_container(container_name=container_name)
>   File 
> "/usr/lib/python3/dist-packages/libcloud/storage/drivers/azure_blobs.py", 
> line 441, in get_container
>     (response.status), driver=self)
> libcloud.common.types.LibcloudError: <LibcloudError in 
> <libcloud.storage.drivers.azure_blobs.AzureBlobsStorageDriver object at 
> 0x7f674c6b67f0> 'Unexpected status code: 400'
> {code}
> Here is the code of ./bin/basic-scenario:
> {code:title=basic-scenario|language=python|borderStyle=solid}
> #!/usr/bin/env python3
> from libcloud.storage.types import Provider
> from libcloud.storage.providers import get_driver
> if __name__ == '__main__':
>    # setup
>    account_name = 'account-name'
>    key = 'secret-key'
>    container_name = 'container-name'
>    # libcloud setup
>    cls = get_driver(Provider.AZURE_BLOBS)
>    # this instanciates ok
>    driver = cls(key=account_name, secret=key)
>    # this explodes
>    container = driver.get_container(container_name=container_name)
>    for c in driver.iterate_container_objects(container):
>        print(c)
> {code}
> Trying to dig in the error, using LIBCLOUD_DEBUG:
> {code}
> LIBCLOUD_DEBUG=error-output ./bin/basic-scenario
> {code}
> I have some more input, here is the content of error-output file:
> {code}
> # -------- begin 140359483662744 request ----------
> curl -i --head -H 'Authorization: SharedKey 
> account-name:blabla/blabla/blabla=' -H 'x-ms-version: 2012-02-12' -H 
> 'User-Agent: libcloud/0.20.0 (Microsoft Azure (blobs)) ' -H 'Accept-Encoding: 
> gzip,deflate' -H 'x-ms-date: Fri, 09 Sep 2016 10:19:36 GMT' -H 
> 'X-LC-Request-ID: 140340383662744' --compress 
> 'https://account-name.blob.core.windows.net:443/container-name?restype=container'
> # -------- begin 140359483662744:140359483745056 response ----------
> HTTP/1.1 400 The value for one of the HTTP headers is not in the correct 
> format.
> Transfer-Encoding: chunked
> Server: Microsoft-HTTPAPI/2.0
> X-Ms-Request-Id: ad3456f8-0002-0076-2f83-0ab6c2888888
> Date: Fri, 09 Sep 2016 10:19:36 GMT
> 0
> 0
> # -------- end 140359483662744:140359483745056 response ----------
> {code}
> As my package is a debian one with what seems an older version (0.20.0, seen 
> in CHANGES.rst and not in the propose jira list), I tried with the current 
> git repository (1.1.0).
> Procedure: 
> 1. purged python3-libcloud from my machine
> 2. `python3 setup.py install` from git repository.
> I have the same error:
> {code}
> # -------- begin 139921458559016 request ----------
> curl -i --head -H 'x-ms-version: 2012-02-12' -H 'Authorization: SharedKey 
> account-name:blabloblu=' -H 'X-LC-Request-ID: 139921458559432' -H 
> 'User-Agent: libcloud/1.1.0 (Microsoft Azure (blobs)) ' -H 'Accept-Encoding: 
> gzip,deflate' -H 'x-ms-date: Fri, 09 Sep 2016 10:51:53 GMT' --compress 
> 'https://account-name.blob.core.windows.net:443/container-name?restype=container'
> # -------- begin 139921458559016:139921458672360 response ----------
> HTTP/1.1 400 The value for one of the HTTP headers is not in the correct 
> format.
> Transfer-Encoding: chunked
> Server: Microsoft-HTTPAPI/2.0
> X-Ms-Request-Id: 10947125-0001-005e-7788-0ac27a888888
> Date: Fri, 09 Sep 2016 10:51:52 GMT
> 0
> 0
> # -------- end 139921458559016:139921458672360 response ----------
> {code}
> I'm stuck there since i don't see anything wrong with the headers.
> Do you please have some hint?
> Thanks for your time
> Note: 
> - I'm confident in the azure blob storage setup and credentials since i got 
> it working with another library (azure-storage via pip3)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to