update
This commit is contained in:
@@ -17,7 +17,7 @@ class InvalidStatusLine(HTTPException):
|
||||
|
||||
|
||||
class UnsupportedEncoding(HTTPException):
|
||||
""" Reponse Encoding not support """
|
||||
""" Encoding not supported """
|
||||
|
||||
def __init(self, enc_type, encoding):
|
||||
self.enc_type = enc_type
|
||||
@@ -39,12 +39,28 @@ class HTTPServerException(Exception):
|
||||
self.body = body
|
||||
|
||||
|
||||
class BadRequest(HTTPServerException):
|
||||
class HTTPServerCloseException(HTTPServerException):
|
||||
""" When thrown, the connection should be closed """
|
||||
|
||||
|
||||
class BadRequest(HTTPServerCloseException):
|
||||
""" Malformed HTTP request"""
|
||||
status_code = 400
|
||||
message = "Bad Request"
|
||||
|
||||
|
||||
class Forbidden(HTTPServerException):
|
||||
""" Request not allowed """
|
||||
status_code = 403
|
||||
message = "Forbidden"
|
||||
|
||||
|
||||
class NotFound(HTTPServerException):
|
||||
""" Resource not found """
|
||||
status_code = 404
|
||||
message = "Not Found"
|
||||
|
||||
|
||||
class MethodNotAllowed(HTTPServerException):
|
||||
""" Method is not allowed """
|
||||
status_code = 405
|
||||
@@ -54,7 +70,7 @@ class MethodNotAllowed(HTTPServerException):
|
||||
self.allowed_methods = allowed_methods
|
||||
|
||||
|
||||
class InternalServerError(HTTPServerException):
|
||||
class InternalServerError(HTTPServerCloseException):
|
||||
""" Internal Server Error """
|
||||
status_code = 500
|
||||
message = "Internal Server Error"
|
||||
@@ -66,16 +82,10 @@ class NotImplemented(HTTPServerException):
|
||||
message = "Not Implemented"
|
||||
|
||||
|
||||
class NotFound(HTTPServerException):
|
||||
""" Resource not found """
|
||||
status_code = 404
|
||||
message = "Not Found"
|
||||
|
||||
|
||||
class Forbidden(HTTPServerException):
|
||||
""" Request not allowed """
|
||||
status_code = 403
|
||||
message = "Forbidden"
|
||||
class HTTPVersionNotSupported(HTTPServerCloseException):
|
||||
""" The server does not support the major version HTTP used in the request message """
|
||||
status_code = 505
|
||||
message = "HTTP Version Not Supported"
|
||||
|
||||
|
||||
class Conflict(HTTPServerException):
|
||||
@@ -84,10 +94,10 @@ class Conflict(HTTPServerException):
|
||||
message = "Conflict"
|
||||
|
||||
|
||||
class HTTPVersionNotSupported(HTTPServerException):
|
||||
""" The server does not support the major version HTTP used in the request message """
|
||||
status_code = 505
|
||||
message = "HTTP Version Not Supported"
|
||||
class NotModified(HTTPServerException):
|
||||
""" Requested resource was not modified """
|
||||
status_code = 304
|
||||
message = "Not Modified"
|
||||
|
||||
|
||||
class InvalidRequestLine(BadRequest):
|
||||
|
Reference in New Issue
Block a user