'Main hook into the WSGI paste.deploy filter/app pipeline.
:param env: The WSGI environment dict.
:param start_response: The WSGI start_response hook.
:returns: Response as per WSGI.'

def __call__(self, env, start_response):

    if (env['REQUEST_METHOD'] == 'OPTIONS'):
        return self.app(env, start_response)
    info = self._get_temp_url_info(env)
    (temp_url_sig, temp_url_expires, temp_url_prefix, filename, inline_disposition) = info
    if ((temp_url_sig is None) and (temp_url_expires is None)):
        return self.app(env, start_response)
    if ((not temp_url_sig) or (not temp_url_expires)):
        return self._invalid(env, start_response)
    (account, container, obj) = self._get_path_parts(env)
    if (not account):
        return self._invalid(env, start_response)
    keys = self._get_keys(env)
    if (not keys):
        return self._invalid(env, start_response)
    if (temp_url_prefix is None):
        path = ('/v1/%s/%s/%s' % (account, container, obj))
    else:
        if (not obj.startswith(temp_url_prefix)):
            return self._invalid(env, start_response)
        path = ('prefix:/v1/%s/%s/%s' % (account, container, temp_url_prefix))
    if (env['REQUEST_METHOD'] == 'HEAD'):
        hmac_vals = (((self._get_hmacs(env, temp_url_expires, path, keys) + self._get_hmacs(env, temp_url_expires, path, keys, request_method='GET')) + self._get_hmacs(env, temp_url_expires, path, keys, request_method='POST')) + self._get_hmacs(env, temp_url_expires, path, keys, request_method='PUT'))
    else:
        hmac_vals = self._get_hmacs(env, temp_url_expires, path, keys)
    is_valid_hmac = False
    hmac_scope = None
    for (hmac, scope) in hmac_vals:
        if streq_const_time(temp_url_sig, hmac):
            is_valid_hmac = True
            hmac_scope = scope
            break
    if (not is_valid_hmac):
        return self._invalid(env, start_response)
    resp = self._clean_disallowed_headers(env, start_response)
    if resp:
        return resp
    self._clean_incoming_headers(env)
    if (hmac_scope == ACCOUNT_SCOPE):
        env['swift.authorize'] = authorize_same_account(account)
    else:
        env['swift.authorize'] = authorize_same_container(account, container)
    env['swift.authorize_override'] = True
    env['REMOTE_USER'] = '.wsgi.tempurl'
    qs = {'temp_url_sig': temp_url_sig, 'temp_url_expires': temp_url_expires}
    if (temp_url_prefix is not None):
        qs['temp_url_prefix'] = temp_url_prefix
    if filename:
        qs['filename'] = filename
    env['QUERY_STRING'] = urlencode(qs)
    def _start_response(status, headers, exc_info=None):
        headers = self._clean_outgoing_headers(headers)
        if ((env['REQUEST_METHOD'] in ('GET', 'HEAD')) and (status[0] == '2')):
            out_headers = []
            existing_disposition = None
            for (h, v) in headers:
                if (h.lower() != 'content-disposition'):
                    out_headers.append((h, v))
                else:
                    existing_disposition = v
            if inline_disposition:
                if filename:
                    disposition_value = disposition_format('inline', filename)
                else:
                    disposition_value = 'inline'
            elif filename:
                disposition_value = disposition_format('attachment', filename)
            elif existing_disposition:
                disposition_value = existing_disposition
            else:
                name = basename(env['PATH_INFO'].rstrip('/'))
                disposition_value = disposition_format('attachment', name)
            value = disposition_value.replace('\n', '%0A')
            out_headers.append(('Content-Disposition', value))
            out_headers.append(('Expires', strftime('%a,    %d    %b    %Y    %H:%M:%S    GMT', gmtime(temp_url_expires))))
            headers = out_headers
        return start_response(status, headers, exc_info)
    return self.app(env, _start_response)
