ModernHttpClient and Azure REST Services

Wondering if anyone has experience using ModernHttpClient with Azure REST services. My code works fine with the .Net HttpClient. With ModernHttpClient I can create a container, but get the following error when trying to upload a blob:

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

Does ModernHttpClient change the headers in any way that would cause a failure to validate? Would it cause the HttpContent to appear to be a different size than reported by (byte[]) blobcontent.length? TIA!

Answers

  • DavidCanoraDavidCanora USMember

    Below are the Response Headers from a successful .Net and unsuccessful ModernHttpClient attempt to upload a blob:

    .Net

    Transfer-Encoding: chunked  
    ETag: 0x8D280EE1D2ACEFF  
    Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0  
    x-ms-request-id: 0a35e186-0001-0056-4dd6-b22ebd000000  
    x-ms-version: 2009-09-19  
    Date: Tue, 30 Jun 2015 01:49:18 GMT  
    

    Modern

    Date: Tue, 30 Jun 2015 01:51:22 GMT  
    OkHttp-Received-Millis: 1435629095708  
    OkHttp-Selected-Protocol: http/1.1  
    OkHttp-Sent-Millis: 1435629083933  
    Server: Microsoft-HTTPAPI/2.0  
    x-ms-request-id: c18abaec-0001-0033-09d7-b29fe0000000  
    
  • DavidCanoraDavidCanora USMember

    Below are the Response Headers from a successful .Net and unsuccessful ModernHttpClient attempt to upload a blob:

    .Net

    Transfer-Encoding: chunked  
    ETag: 0x8D280EE1D2ACEFF  
    Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0  
    x-ms-request-id: 0a35e186-0001-0056-4dd6-b22ebd000000  
    x-ms-version: 2009-09-19  
    Date: Tue, 30 Jun 2015 01:49:18 GMT  
    

    Modern

    Date: Tue, 30 Jun 2015 01:51:22 GMT  
    OkHttp-Received-Millis: 1435629095708  
    OkHttp-Selected-Protocol: http/1.1  
    OkHttp-Sent-Millis: 1435629083933  
    Server: Microsoft-HTTPAPI/2.0  
    x-ms-request-id: c18abaec-0001-0033-09d7-b29fe0000000  
    
  • DavidCanoraDavidCanora USMember

    Below are the Response Headers from a successful .Net and unsuccessful ModernHttpClient attempt to upload a blob:

    .Net

    Transfer-Encoding: chunked  
    ETag: 0x8D280EE1D2ACEFF  
    Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0  
    x-ms-request-id: 0a35e186-0001-0056-4dd6-b22ebd000000  
    x-ms-version: 2009-09-19  
    Date: Tue, 30 Jun 2015 01:49:18 GMT  
    

    Modern

    Date: Tue, 30 Jun 2015 01:51:22 GMT  
    OkHttp-Received-Millis: 1435629095708  
    OkHttp-Selected-Protocol: http/1.1  
    OkHttp-Sent-Millis: 1435629083933  
    Server: Microsoft-HTTPAPI/2.0  
    x-ms-request-id: c18abaec-0001-0033-09d7-b29fe0000000  
    
  • DavidCanoraDavidCanora USMember

    Below are the Response Headers from a successful .Net and unsuccessful ModernHttpClient attempt to upload a blob:

    .Net

    Transfer-Encoding: chunked  
    ETag: 0x8D280EE1D2ACEFF  
    Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0  
    x-ms-request-id: 0a35e186-0001-0056-4dd6-b22ebd000000  
    x-ms-version: 2009-09-19  
    Date: Tue, 30 Jun 2015 01:49:18 GMT  
    

    Modern

    Date: Tue, 30 Jun 2015 01:51:22 GMT  
    OkHttp-Received-Millis: 1435629095708  
    OkHttp-Selected-Protocol: http/1.1  
    OkHttp-Sent-Millis: 1435629083933  
    Server: Microsoft-HTTPAPI/2.0  
    x-ms-request-id: c18abaec-0001-0033-09d7-b29fe0000000  
    
Sign In or Register to comment.