

def handle_object(self, env, start_response):
    '\n        Handles a possible static web request for an object. This object could\n        resolve into an index or listing request.\n\n        :param env: The original WSGI environment dict.\n        :param start_response: The original WSGI start_response hook.\n        '
    tmp_env = dict(env)
    tmp_env['HTTP_USER_AGENT'] = ('%s StaticWeb' % env.get('HTTP_USER_AGENT'))
    tmp_env['swift.source'] = 'SW'
    resp = self._app_call(tmp_env)
    status_int = self._get_status_int()
    self._get_container_info(env)
    if (is_success(status_int) or is_redirection(status_int)):
        if (not self._dir_type):
            self._dir_type = 'application/directory'
        content_length = self._response_header_value('content-length')
        content_length = (int(content_length) if content_length else 0)
        if ((self._response_header_value('content-type') == self._dir_type) and (content_length <= 1)):
            status_int = HTTP_NOT_FOUND
        else:
            start_response(self._response_status, self._response_headers, self._response_exc_info)
            return resp
    if (status_int != HTTP_NOT_FOUND):
        self._error = None
        return self._error_response(resp, env, start_response)
    if ((not self._listings) and (not self._index)):
        start_response(self._response_status, self._response_headers, self._response_exc_info)
        return resp
    status_int = HTTP_NOT_FOUND
    if self._index:
        tmp_env = dict(env)
        tmp_env['HTTP_USER_AGENT'] = ('%s StaticWeb' % env.get('HTTP_USER_AGENT'))
        tmp_env['swift.source'] = 'SW'
        if (not tmp_env['PATH_INFO'].endswith('/')):
            tmp_env['PATH_INFO'] += '/'
        tmp_env['PATH_INFO'] += self._index
        resp = self._app_call(tmp_env)
        status_int = self._get_status_int()
        if (is_success(status_int) or is_redirection(status_int)):
            if (not env['PATH_INFO'].endswith('/')):
                resp = HTTPMovedPermanently(location=(env['PATH_INFO'] + '/'))
                return resp(env, start_response)
            start_response(self._response_status, self._response_headers, self._response_exc_info)
            return resp
    if (status_int == HTTP_NOT_FOUND):
        if (not env['PATH_INFO'].endswith('/')):
            tmp_env = make_env(env, 'GET', ('/%s/%s/%s' % (self.version, self.account, self.container)), self.agent, swift_source='SW')
            tmp_env['QUERY_STRING'] = ('limit=1&format=json&delimiter=/&limit=1&prefix=%s' % quote((self.obj + '/')))
            resp = self._app_call(tmp_env)
            body = ''.join(resp)
            if ((not is_success(content_length._get_status_int())) or (not body) or (not json.loads(body))):
                resp = HTTPNotFound()(env, self._start_response)
                return self._error_response(resp, env, start_response)
            resp = HTTPMovedPermanently(location=(env['PATH_INFO'] + '/'))
            return resp(env, start_response)
        return self._listing(env, start_response, self.obj)

dataset/ETHPy150Open openstack/swift/swift/common/middleware/staticweb.py _StaticWebContext.handle_object/VarMisuse@514/873 `self`->`content_length`