This file is indexed.

/usr/lib/python2.7/dist-packages/ftpcloudfs/chunkobject.py is in python-ftp-cloudfs 0.25.2-1.

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import logging
from urllib import quote
from socket import timeout
from ssl import SSLError
from swiftclient.client import ClientException, http_connection

from ftpcloudfs.utils import smart_str

class ChunkObject(object):

    def __init__(self, conn, container, name, content_type=None):
        # FIXME
        # self._name_check()

        parsed, self.chunkable_http = http_connection(conn.url)

        logging.debug("ChunkObject: new connection open (%r, %r)" % (parsed, self.chunkable_http))

        path = '%s/%s/%s' % (parsed.path.rstrip('/'),
                             quote(smart_str(container)),
                             quote(smart_str(name)),
                             )
        headers = { 'X-Auth-Token': conn.token,
                    'Content-Type': content_type or 'application/octet-stream',
                    'Transfer-Encoding': 'chunked',
                    # User-Agent ?
                    }
        if conn.real_ip:
            headers['X-Forwarded-For'] = conn.real_ip
        self.chunkable_http.putrequest('PUT', path)
        for key, value in headers.iteritems():
            self.chunkable_http.putheader(key, value)
        self.chunkable_http.endheaders()
        logging.debug("ChunkedObject: path=%r, headers=%r" % (path, headers))

    def send_chunk(self, chunk):
        logging.debug("ChunkObject: sending %s bytes" % len(chunk))
        try:
            self.chunkable_http.send("%X\r\n" % len(chunk))
            self.chunkable_http.send(chunk)
            self.chunkable_http.send("\r\n")
        except (timeout, SSLError), err:
            raise ClientException(err.message)

    def finish_chunk(self):
        logging.debug("ChunkObject: finish_chunk")
        try:
            self.chunkable_http.send("0\r\n\r\n")
            response = self.chunkable_http.getresponse()
        except (timeout, SSLError), err:
            raise ClientException(err.message)

        try:
            response.read()
        except (timeout, SSLError):
            # this is not relevant, keep going
            pass

        if response.status // 100 != 2:
            raise ClientException(response.reason,
                                  http_status=response.status,
                                  http_reason=response.reason,
                                  )