# Path: oioswift/common/middleware/versioned_writes.py
# DELETE_MARKER_CONTENT_TYPE = vw.DELETE_MARKER_CONTENT_TYPE


import base64
import mimetypes
import six
import time
from cgi import parse_header
from collections import defaultdict
from datetime import datetime
from hashlib import md5
from oio.common.json import json
from swift.common.exceptions import ListingIterError, SegmentError
from swift.common.middleware.bulk import ACCEPTABLE_FORMATS, get_response_body
from swift.common.middleware.listing_formats import \
    MAX_CONTAINER_LISTING_CONTENT_LENGTH
from swift.common.middleware.slo import DEFAULT_MAX_MANIFEST_SEGMENTS, \
    DEFAULT_MAX_MANIFEST_SIZE, DEFAULT_YIELD_FREQUENCY, \
    parse_and_validate_input, StaticLargeObject, SYSMETA_SLO_ETAG, \
    SYSMETA_SLO_SIZE, SloGetContext
from oioswift.common.middleware.versioned_writes import \
    DELETE_MARKER_CONTENT_TYPE
from swift.common.swob import Request, HTTPBadRequest, HTTPMethodNotAllowed, \
    HTTPRequestEntityTooLarge, HTTPLengthRequired, HTTPOk, HTTPConflict, \
    HTTPUnprocessableEntity, HTTPException, RESPONSE_REASONS, Response
from swift.common.utils import close_if_possible, closing_if_possible, \
    config_true_value, get_valid_utf8_str, override_bytes_from_content_type, \
    quote, register_swift_info, RateLimitedIterator
from swift.common.request_helpers import SegmentedIterable, \
    update_etag_is_at_header, resolve_etag_is_at_header
from swift.common.wsgi import make_subrequest
                resp_dict['Last Modified'] = resp.headers['Last-Modified']

            if heartbeat:
                resp_dict['Response Body'] = resp.body
                yield separator + get_response_body(
                    out_content_type, resp_dict, [], 'upload')
            else:
                for chunk in resp(req.environ, start_response):
                    yield chunk

        return resp_iter()

    def handle_container_listing(self, req, start_response):
        resp = req.get_response(self.app)
        if not resp.is_success or resp.content_type != 'application/json':
            return resp(req.environ, start_response)
        if resp.content_length is None:
            return resp(req.environ, start_response)
        if resp.content_length > MAX_CONTAINER_LISTING_CONTENT_LENGTH:
            self.logger.warn(
                'The content length (%d) of the listing is too long (max=%d)',
                resp.content_length, MAX_CONTAINER_LISTING_CONTENT_LENGTH)
            return resp(req.environ, start_response)
        try:
            listing = json.loads(resp.body)
        except ValueError:
            return resp(req.environ, start_response)

        for item in listing:
            if 'subdir' in item \

# Path: oioswift/common/middleware/versioned_writes.py
# DELETE_MARKER_CONTENT_TYPE = vw.DELETE_MARKER_CONTENT_TYPE


# Path: oioswift/common/middleware/slo.py
import base64
import mimetypes
import six
import time
from cgi import parse_header
from collections import defaultdict
from datetime import datetime
from hashlib import md5
from oio.common.json import json
from swift.common.exceptions import ListingIterError, SegmentError
from swift.common.middleware.bulk import ACCEPTABLE_FORMATS, get_response_body
from swift.common.middleware.listing_formats import \
    MAX_CONTAINER_LISTING_CONTENT_LENGTH
from swift.common.middleware.slo import DEFAULT_MAX_MANIFEST_SEGMENTS, \
    DEFAULT_MAX_MANIFEST_SIZE, DEFAULT_YIELD_FREQUENCY, \
    parse_and_validate_input, StaticLargeObject, SYSMETA_SLO_ETAG, \
    SYSMETA_SLO_SIZE, SloGetContext
from oioswift.common.middleware.versioned_writes import \
    DELETE_MARKER_CONTENT_TYPE
from swift.common.swob import Request, HTTPBadRequest, HTTPMethodNotAllowed, \
    HTTPRequestEntityTooLarge, HTTPLengthRequired, HTTPOk, HTTPConflict, \
    HTTPUnprocessableEntity, HTTPException, RESPONSE_REASONS, Response
from swift.common.utils import close_if_possible, closing_if_possible, \
    config_true_value, get_valid_utf8_str, override_bytes_from_content_type, \
    quote, register_swift_info, RateLimitedIterator
from swift.common.request_helpers import SegmentedIterable, \
    update_etag_is_at_header, resolve_etag_is_at_header
from swift.common.wsgi import make_subrequest

                resp_dict['Last Modified'] = resp.headers['Last-Modified']

            if heartbeat:
                resp_dict['Response Body'] = resp.body
                yield separator + get_response_body(
                    out_content_type, resp_dict, [], 'upload')
            else:
                for chunk in resp(req.environ, start_response):
                    yield chunk

        return resp_iter()

    def handle_container_listing(self, req, start_response):
        resp = req.get_response(self.app)
        if not resp.is_success or resp.content_type != 'application/json':
            return resp(req.environ, start_response)
        if resp.content_length is None:
            return resp(req.environ, start_response)
        if resp.content_length > MAX_CONTAINER_LISTING_CONTENT_LENGTH:
            self.logger.warn(
                'The content length (%d) of the listing is too long (max=%d)',
                resp.content_length, MAX_CONTAINER_LISTING_CONTENT_LENGTH)
            return resp(req.environ, start_response)
        try:
            listing = json.loads(resp.body)
        except ValueError:
            return resp(req.environ, start_response)

        for item in listing:
            if 'subdir' in item \

                    or item.get('content_type') == DELETE_MARKER_CONTENT_TYPE: