All Products
Search
Document Center

Object Storage Service:0016-00000606

Last Updated:Apr 29, 2024

Problem description

The Content-MD5 request header is missing in the DeleteMultipleObjects request.

Causes

You initiated a DeleteMultipleObjects request, but the Content-MD5 request header is missing in the request.

Examples

The required Content-MD5 request header is missing in the following DeleteMultipleObjects request.

POST /?delete HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Wed, 29 Feb 2012 12:26:16 GMT
Content-Length:151
Authorization: OSS qn6q**************:77Dv****************
<?xml version="1.0" encoding="UTF-8"?>
<Delete> 
  <Quiet>false</Quiet>  
  <Object> 
    <Key>multipart.data</Key> 
  </Object>  
  <Object> 
    <Key>test.jpg</Key> 
  </Object>  
  <Object> 
    <Key>demo.jpg</Key> 
  </Object> 
</Delete>

Solutions

Add the Content-MD5 request header to the request.

The value of the Content-MD5 header is a string calculated by using the MD5 algorithm. The header is used to check whether the content of the received message is the same as that of the sent message. After the Content-MD5 request header is uploaded, OSS calculates the MD5 hash based on the message body and checks whether the calculated MD5 hash is the same as the Content-MD5 value specified in the request header.

Content-MD5 is calculated based on the following method:

  1. Encrypt the message body of the DeleteMultipleObjects request by using the MD5 algorithm to obtain a 128-bit byte array.

  2. Encode the byte array in Base64.

Sample request:

POST /?delete HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Wed, 29 Feb 2012 12:26:16 GMT
Content-Length:151
Content-MD5: ohhnqLBJFiKkPSBO1eNaUA==
Authorization: OSS qn6q**************:77Dv****************
<?xml version="1.0" encoding="UTF-8"?>
<Delete> 
  <Quiet>false</Quiet>  
  <Object> 
    <Key>multipart.data</Key> 
  </Object>  
  <Object> 
    <Key>test.jpg</Key> 
  </Object>  
  <Object> 
    <Key>demo.jpg</Key> 
  </Object> 
</Delete>

References