'Handle HTTP POST requests for the Swift Object Server.'

@public
@timing_stats()
def POST(self, request):

    (device, partition, account, container, obj, policy) = get_name_and_placement(request, 5, 5, True)
    req_timestamp = valid_timestamp(request)
    new_delete_at = int((request.headers.get('X-Delete-At') or 0))
    if (new_delete_at and (new_delete_at < time.time())):
        return HTTPBadRequest(body='X-Delete-At    in    past', request=request, content_type='text/plain')
    next_part_power = request.headers.get('X-Backend-Next-Part-Power')
    try:
        disk_file = self.get_diskfile(device, partition, account, container, obj, policy=policy, open_expired=config_true_value(request.headers.get('x-backend-replication', 'false')), next_part_power=next_part_power)
    except DiskFileDeviceUnavailable:
        return HTTPInsufficientStorage(drive=device, request=request)
    try:
        orig_metadata = disk_file.read_metadata()
    except DiskFileXattrNotSupported:
        return HTTPInsufficientStorage(drive=device, request=request)
    except (DiskFileNotExist, DiskFileQuarantined):
        return HTTPNotFound(request=request)
    orig_timestamp = Timestamp(orig_metadata.get('X-Timestamp', 0))
    orig_ctype_timestamp = disk_file.content_type_timestamp
    req_ctype_time = '0'
    req_ctype = request.headers.get('Content-Type')
    if req_ctype:
        req_ctype_time = request.headers.get('Content-Type-Timestamp', req_timestamp.internal)
    req_ctype_timestamp = Timestamp(req_ctype_time)
    if ((orig_timestamp >= req_timestamp) and (orig_ctype_timestamp >= req_ctype_timestamp)):
        return HTTPConflict(request=request, headers={'X-Backend-Timestamp': orig_timestamp.internal})
    if (req_timestamp > orig_timestamp):
        metadata = {'X-Timestamp': req_timestamp.internal}
        self._preserve_slo_manifest(metadata, orig_metadata)
        metadata.update((val for val in request.headers.items() if (is_user_meta('object', val[0]) or is_object_transient_sysmeta(val[0]))))
        headers_to_copy = (request.headers.get('X-Backend-Replication-Headers', '').split() + list(self.allowed_headers))
        for header_key in headers_to_copy:
            if (header_key in request.headers):
                header_caps = header_key.title()
                metadata[header_caps] = request.headers[header_key]
        orig_delete_at = int((orig_metadata.get('X-Delete-At') or 0))
        if (orig_delete_at != new_delete_at):
            if new_delete_at:
                self.delete_at_update('PUT', new_delete_at, account, container, obj, request, device, policy)
            if orig_delete_at:
                self.delete_at_update('DELETE', orig_delete_at, account, container, obj, request, device, policy)
    else:
        metadata = dict(disk_file.get_metafile_metadata())
    if (req_ctype_timestamp > orig_ctype_timestamp):
        content_type_headers = {'Content-Type': request.headers['Content-Type'], 'Content-Type-Timestamp': req_ctype_timestamp.internal}
        metadata.update(content_type_headers)
    else:
        content_type_headers = {'Content-Type': disk_file.content_type, 'Content-Type-Timestamp': orig_ctype_timestamp.internal}
        if (orig_ctype_timestamp != disk_file.data_timestamp):
            metadata.update(content_type_headers)
    try:
        disk_file.write_metadata(metadata)
    except (DiskFileXattrNotSupported, DiskFileNoSpace):
        return HTTPInsufficientStorage(drive=device, request=request)
    if (content_type_headers['Content-Type-Timestamp'] != disk_file.data_timestamp):
        (_, swift_bytes) = extract_swift_bytes(disk_file.get_datafile_metadata()['Content-Type'])
        if swift_bytes:
            content_type_headers['Content-Type'] += (';swift_bytes=%s' % swift_bytes)
    update_headers = HeaderKeyDict({'x-size': orig_metadata['Content-Length'], 'x-content-type': content_type_headers['Content-Type'], 'x-timestamp': disk_file.data_timestamp.internal, 'x-content-type-timestamp': content_type_headers['Content-Type-Timestamp'], 'x-meta-timestamp': metadata['X-Timestamp'], 'x-etag': orig_metadata['ETag']})
    if ('X-Object-Sysmeta-Ec-Etag' in orig_metadata):
        update_headers['X-Etag'] = orig_metadata['X-Object-Sysmeta-Ec-Etag']
    if ('X-Object-Sysmeta-Ec-Content-Length' in orig_metadata):
        update_headers['X-Size'] = orig_metadata['X-Object-Sysmeta-Ec-Content-Length']
    self._check_container_override(update_headers, orig_metadata)
    self.container_update('PUT', account, container, obj, request, update_headers, device, policy)
    resp_headers = {}
    for (key, value) in orig_metadata.items():
        if is_sys_meta('object', key):
            resp_headers[key] = value
    return HTTPAccepted(request=request, headers=resp_headers)
