如何为MultiPart Completion HTTP POST请求计算CONTENT-MD5标头值?

时间:2018-12-21 06:21:20

标签: amazon-s3 md5

我正在使用最新的s3browser 8.1.5,并注意到完成向AWS S3的分段上传的POST请求的标头中有$(data).filter('.allMessages')

如何计算CONTENT-MD5标头值?

对于以下请求,CONTENT-MD5与正文的base64编码的md5不匹配。

在tcpdump中:

CONTENT-MD5

谢谢

Bhaskar

1 个答案:

答案 0 :(得分:0)

Content-MD5确实是主体/内容的base64编码md5(也已由s3browser支持小组确认)。

上面的错误并未使double quotes逃脱

root@VM:~$ echo -n "<CompleteMultipartUpload><Part><PartNumber>1</PartNumber><ETag>\""3e27d45b10b2d069a00eb079a62b90ea\""</ETag></Part><Part><PartNumber>2</PartNumber><ETag>\""eea2223793a13e29bbef110f92b29e40\""</ETag></Part><Part><PartNumber>3</PartNumber><ETag>\""b9bf9ef5a37f63c72eb108767e64d56f\""</ETag></Part><Part><PartNumber>4</PartNumber><ETag>\""0667c6da478617af1cf86c3f4f0e86ac\""</ETag></Part><Part><PartNumber>5</PartNumber><ETag>\""5433c390b9fc98fd90b9c0334f56beba\""</ETag></Part><Part><PartNumber>6</PartNumber><ETag>\""4539dcbbac5f028637d17180a674881e\""</ETag></Part><Part><PartNumber>7</PartNumber><ETag>\""b079a02747e444b95bec8d3374e1b6df\""</ETag></Part><Part><PartNumber>8</PartNumber><ETag>\""9f22ca90596f4ff455e1ab79ba12fdc0\""</ETag></Part><Part><PartNumber>9</PartNumber><ETag>\""c573cc702aa3f17cea3ca4248e6c20e9\""</ETag></Part><Part><PartNumber>10</PartNumber><ETag>\""b6d53f23fd0fa4bb5b8e702f0cdc2661\""</ETag></Part><Part><PartNumber>11</PartNumber><ETag>\""e780dd0053d08366b062deb640d61e4d\""</ETag></Part><Part><PartNumber>12</PartNumber><ETag>\""a212f6c80c8511c6a26405f909dacc70\""</ETag></Part><Part><PartNumber>13</PartNumber><ETag>\""5530ed86f6423ad8ab1c0cb2a703e9ef\""</ETag></Part></CompleteMultipartUpload>" | openssl md5 -binary | openssl enc -base64
z8hR0GST3Hm6f518pQ7XUQ==