locked
Attempt to write to page blob fails with "Error: The value for one of the HTTP headers is not in the correct format. The value for one of the HTTP headers is not in the correct format." RRS feed

  • Question

  • I'm trying to use azure-storage-cpp's APIs to write to page blobs using the following code:

    // The code is representative. I have removed some of the error handling code.

    void page_blobs_async()
    {

         // Initialize storage account
          azure::storage::cloud_storage_account storage_account = azure::storage::cloud_storage_account::parse(storage_connection_string);

          // Create a blob container
          azure::storage::cloud_blob_client blob_client = storage_account.create_cloud_blob_client();
          azure::storage::cloud_blob_container container = blob_client.get_container_reference(_XPLATSTR("my-sample-page-async-container"));

          // Return value is true if the container did not exist and was successfully created.
          container.create_if_not_exists();

          // Make the blob container publicly accessible
          azure::storage::blob_container_permissions permissions;
          permissions.set_public_access(azure::storage::blob_container_public_access_type::blob);
          container.upload_permissions(permissions);
          filename = "DataFile1.txt" // This contains '1'
          string blob_name = "async_blob"
          concurrency::streams::istream input_stream = concurrency::streams::file_stream<uint8_t>::open_istream(_XPLATSTR(filename)).get();
          azure::storage::cloud_block_blob blob1 = container.get_block_blob_reference(_XPLATSTR(blob_name));
          azure::storage::cloud_page_blob blob1 = container.get_page_blob_reference(_XPLATSTR(blob_name));
          blob1.create(16 * 1024 * 1024);
          std::cout<<"Blob write started"<<std::endl;
          blob1.upload_from_stream(input_stream);
    }

    I get the following error:

    Error: The value for one of the HTTP headers is not in the correct format.
    The value for one of the HTTP headers is not in the correct format.

    Header dump:

    RequestId:e4fe5ee9-e01e-0045-6076-386b87000000
    Time:2018-08-20T11:08:57.8352526Z
    headers Date:Mon, 20 Aug 2018 11:08:57 GMT
    headers ETag:"0x8D6068BAC4DC466"
    headers Last-Modified:Mon, 20 Aug 2018 10:57:08 GMT
    headers Server:Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    headers Transfer-Encoding:chunked
    headers x-ms-blob-public-access:blob
    headers x-ms-lease-state:available
    headers x-ms-lease-status:unlocked
    headers x-ms-request-id:e4fe5ebd-e01e-0045-3a76-386b87000000
    headers x-ms-version:2017-04-17
    headers Date:Mon, 20 Aug 2018 11:08:57 GMT
    headers ETag:"0x8D6068D535B837D"
    headers Last-Modified:Mon, 20 Aug 2018 11:08:57 GMT
    headers Server:Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    headers Transfer-Encoding:chunked
    headers x-ms-request-id:e4fe5ec5-e01e-0045-4076-386b87000000
    headers x-ms-version:2017-04-17
    headers Date:Mon, 20 Aug 2018 11:08:57 GMT
    headers ETag:"0x8D6068D535DE4B5"
    headers Last-Modified:Mon, 20 Aug 2018 11:08:57 GMT
    headers Server:Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    headers Transfer-Encoding:chunked
    headers x-ms-request-id:e4fe5ee4-e01e-0045-5b76-386b87000000
    headers x-ms-request-server-encrypted:true
    headers x-ms-version:2017-04-17
    Blob write started
    headers Content-Length:331
    headers Content-Type:application/xml
    headers Date:Mon, 20 Aug 2018 11:08:57 GMT
    headers Server:Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    headers x-ms-request-id:e4fe5ee9-e01e-0045-6076-386b87000000
    headers x-ms-version:2017-04-17
    headers Content-Length:331
    headers Content-Type:application/xml
    headers Date:Mon, 20 Aug 2018 11:08:57 GMT
    headers Server:Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    headers x-ms-request-id:e4fe5ee9-e01e-0045-6076-386b87000000
    headers x-ms-version:2017-04-17

    I'm using cpprestsdk-2.9.1 and Ubuntu 16.04. Can someone help debugging this?

    Monday, August 20, 2018 12:10 PM

All replies