This file is indexed.

/usr/share/pyshared/restkit/errors.py is in python-restkit 4.2.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
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# -*- coding: utf-8 -
#
# This file is part of restkit released under the MIT license.
# See the NOTICE for more information.

"""
exception classes.
"""

class ResourceError(Exception):
    """ default error class """

    status_int = None

    def __init__(self, msg=None, http_code=None, response=None):
        self.msg = msg or ''
        self.status_int = http_code or self.status_int
        self.response = response
        Exception.__init__(self)

    def _get_message(self):
        return self.msg
    def _set_message(self, msg):
        self.msg = msg or ''
    message = property(_get_message, _set_message)

    def __str__(self):
        if self.msg:
            return self.msg
        try:
            return str(self.__dict__)
        except (NameError, ValueError, KeyError), e:
            return 'Unprintable exception %s: %s' \
                % (self.__class__.__name__, str(e))


class ResourceNotFound(ResourceError):
    """Exception raised when no resource was found at the given url.
    """
    status_int = 404

class Unauthorized(ResourceError):
    """Exception raised when an authorization is required to access to
    the resource specified.
    """

class ResourceGone(ResourceError):
    """
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.11
    """
    status_int = 410

class RequestFailed(ResourceError):
    """Exception raised when an unexpected HTTP error is received in response
    to a request.


    The request failed, meaning the remote HTTP server returned a code
    other than success, unauthorized, or NotFound.

    The exception message attempts to extract the error

    You can get the status code by e.status_int, or see anything about the
    response via e.response. For example, the entire result body (which is
    probably an HTML error page) is e.response.body.
    """

class RedirectLimit(Exception):
    """Exception raised when the redirection limit is reached."""

class RequestError(Exception):
    """Exception raised when a request is malformed"""

class RequestTimeout(Exception):
    """ Exception raised on socket timeout """

class InvalidUrl(Exception):
    """
    Not a valid url for use with this software.
    """

class ResponseError(Exception):
    """ Error raised while getting response or decompressing response stream"""


class ProxyError(Exception):
    """ raised when proxy error happend"""

class BadStatusLine(Exception):
    """ Exception returned by the parser when the status line is invalid"""
    pass

class ParserError(Exception):
    """ Generic exception returned by the parser """
    pass

class UnexpectedEOF(Exception):
    """ exception raised when remote closed the connection """

class AlreadyRead(Exception):
    """ raised when a response have already been read """

class ProxyError(Exception):
    pass

#############################
# HTTP parser errors
#############################

class ParseException(Exception):
    pass

class NoMoreData(ParseException):
    def __init__(self, buf=None):
        self.buf = buf
    def __str__(self):
        return "No more data after: %r" % self.buf

class InvalidRequestLine(ParseException):
    def __init__(self, req):
        self.req = req
        self.code = 400

    def __str__(self):
        return "Invalid HTTP request line: %r" % self.req

class InvalidRequestMethod(ParseException):
    def __init__(self, method):
        self.method = method

    def __str__(self):
        return "Invalid HTTP method: %r" % self.method

class InvalidHTTPVersion(ParseException):
    def __init__(self, version):
        self.version = version

    def __str__(self):
        return "Invalid HTTP Version: %s" % self.version

class InvalidHTTPStatus(ParseException):
    def __init__(self, status):
        self.status = status

    def __str__(self):
        return "Invalid HTTP Status: %s" % self.status

class InvalidHeader(ParseException):
    def __init__(self, hdr):
        self.hdr = hdr

    def __str__(self):
        return "Invalid HTTP Header: %r" % self.hdr

class InvalidHeaderName(ParseException):
    def __init__(self, hdr):
        self.hdr = hdr

    def __str__(self):
        return "Invalid HTTP header name: %r" % self.hdr

class InvalidChunkSize(ParseException):
    def __init__(self, data):
        self.data = data

    def __str__(self):
        return "Invalid chunk size: %r" % self.data

class ChunkMissingTerminator(ParseException):
    def __init__(self, term):
        self.term = term

    def __str__(self):
        return "Invalid chunk terminator is not '\\r\\n': %r" % self.term

class HeaderLimit(ParseException):
    """ exception raised when we gore more headers than
    max_header_count
    """