Add X-Timestamp header to upload file to swift

In uploading files as object to swift,
Response 400 Bad Request with "Missing X-Timestamp header" message.

To fix above, add "X-Timestamp" to request header.

Change-Id: I9615eedc54403a7dba88e3110b6439f7829b3097
This commit is contained in:
Hajime Kondo 2018-04-27 07:50:25 +00:00
parent 7444891218
commit 1eb2fe4dc0
1 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,7 @@
from json import loads as json_loads
from slogging.compressing_file_reader import CompressingFileReader
from swift.common import swob
from swift.common import utils
from swift.proxy.server import Application
from urllib import quote
@ -93,7 +94,9 @@ class InternalProxy(object):
if not self.create_container(account, container):
return False
send_headers = {'Transfer-Encoding': 'chunked'}
timestamp = utils.Timestamp.now().internal
send_headers = {'Transfer-Encoding': 'chunked',
'X-Timestamp': timestamp}
if headers:
send_headers.update(headers)