我们的应用程序需要上传大小为 0 的 blob。我们使用 cURL 来调用 Azure 存储 REST API。上传大小时失败并出现 HTTP 错误代码[400]
以下错误消息返回
<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>InvalidHeaderValue</Code>
<Message>
The value for one of the HTTP headers
is not in the correct format.
RequestId:2b1ec18b-0001-007d-7811-e40725000000
Time:2016-07-22T12:07:28.5435467Z
</Message>
<HeaderName>Content-Length</HeaderName>
<HeaderValue>-1</HeaderValue>
</Error>
通过wireshark,我们确保了内容长度头的值被正确发送。
以下是从wireshark捕获的标头
PUT /test/DC70439C-5004-11E6-B4B2-91D87435845D HTTP/1.1
Host: mytest.blob.core.windows.net
Accept: */*
Transfer-Encoding: chunked
x-ms-blob-type:BlockBlob
x-ms-version:2015-02-21
Content-Length:0
x-ms-date:Fri, 22 Jul 2016 12:07:28 GMT
Authorization:SharedKey kanchan:HQQ7a47TPQtEhL0ek6rim64ZKC8NRubgKuq+4Os+Aoo=
Expect: 100-continue
你能帮忙弄清楚为什么 content-length 标头值被设置为 -1 吗?
谢谢和问候, 拉胡尔·奈克