This file is indexed.

/usr/share/pyshared/twisted/web2/filter/location.py is in python-twisted-web2 8.1.0-3build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from twisted.web2 import responsecode
import urlparse

__all__ = ['addLocation']

def addLocation(request, location):
    """
    Add a C{location} header to the response if the response status is
    CREATED.
    @param request: L{IRequest} the request being processed
    @param location: the URI to use in the C{location} header
    """
    def locationFilter(request, response):
        if (response.code == responsecode.CREATED):
            #
            # Check to see whether we have an absolute URI or not.
            # If not, have the request turn it into an absolute URI.
            #
            (scheme, host, path, params, querystring, fragment) = urlparse.urlparse(location)

            if scheme == "":
                uri = request.unparseURL(path=location)
            else:
                uri = location
        
            response.headers.setHeader("location", uri)

        return response

    request.addResponseFilter(locationFilter)