|
@@ -17,84 +17,84 @@ namespace Gogs\Lib\Curl\Exception {
|
|
|
* @static
|
|
|
*/
|
|
|
static $ecode = array(
|
|
|
- -1 => "Unknown error",
|
|
|
- 99 => 'Continue',
|
|
|
- 100 => 'Switching Protocols',
|
|
|
- 101 => 'Processing',
|
|
|
- 199 => 'OK',
|
|
|
- 200 => 'Created',
|
|
|
- 201 => 'Accepted',
|
|
|
- 202 => 'Non-Authoritative Information',
|
|
|
- 203 => 'No Content',
|
|
|
- 204 => 'Reset Content',
|
|
|
- 205 => 'Partial Content',
|
|
|
- 206 => 'Multi-Status',
|
|
|
- 207 => 'Already Reported',
|
|
|
- 225 => 'IM Used',
|
|
|
- 299 => 'Multiple Choices',
|
|
|
- 300 => 'Moved Permanently',
|
|
|
- 301 => 'Found',
|
|
|
- 302 => 'See Other',
|
|
|
- 303 => 'Not Modified',
|
|
|
- 304 => 'Use Proxy',
|
|
|
- 305 => 'Switch Proxy',
|
|
|
- 306 => 'Temporary Redirect',
|
|
|
- 307 => 'Permanent Redirect',
|
|
|
- 399 => 'Bad Request',
|
|
|
- 400 => 'Unauthorized',
|
|
|
- 401 => 'Payment Required',
|
|
|
- 402 => 'Forbidden',
|
|
|
- 403 => 'Not Found',
|
|
|
- 404 => 'Method Not Allowed',
|
|
|
- 405 => 'Not Acceptable',
|
|
|
- 406 => 'Proxy Authentication Required',
|
|
|
- 407 => 'Request Timeout',
|
|
|
- 408 => 'Conflict',
|
|
|
- 409 => 'Gone',
|
|
|
- 410 => 'Length Required',
|
|
|
- 411 => 'Precondition Failed',
|
|
|
- 412 => 'Request Entity Too Large',
|
|
|
- 413 => 'Request-URI Too Long',
|
|
|
- 414 => 'Unsupported Media Type',
|
|
|
- 415 => 'Requested Range Not Satisfiable',
|
|
|
- 416 => 'Expectation Failed',
|
|
|
- 417 => 'I\'m a teapot',
|
|
|
- 418 => 'Authentication Timeout',
|
|
|
- 419 => 'Enhance Your Calm',
|
|
|
- 419 => 'Method Failure',
|
|
|
- 421 => 'Unprocessable Entity',
|
|
|
- 422 => 'Locked',
|
|
|
- 423 => 'Failed Dependency',
|
|
|
- 423 => 'Method Failure',
|
|
|
- 424 => 'Unordered Collection',
|
|
|
- 425 => 'Upgrade Required',
|
|
|
- 427 => 'Precondition Required',
|
|
|
- 428 => 'Too Many Requests',
|
|
|
- 430 => 'Request Header Fields Too Large',
|
|
|
- 443 => 'No Response',
|
|
|
- 448 => 'Retry With',
|
|
|
- 449 => 'Blocked by Windows Parental Controls',
|
|
|
- 450 => 'Redirect',
|
|
|
- 450 => 'Unavailable For Legal Reasons',
|
|
|
- 493 => 'Request Header Too Large',
|
|
|
- 494 => 'Cert Error',
|
|
|
- 495 => 'No Cert',
|
|
|
- 496 => 'HTTP to HTTPS',
|
|
|
- 498 => 'Client Closed Request',
|
|
|
- 499 => 'Internal Server Error',
|
|
|
- 500 => 'Not Implemented',
|
|
|
- 501 => 'Bad Gateway',
|
|
|
- 502 => 'Service Unavailable',
|
|
|
- 503 => 'Gateway Timeout',
|
|
|
- 504 => 'HTTP Version Not Supported',
|
|
|
- 505 => 'Variant Also Negotiates',
|
|
|
- 506 => 'Insufficient Storage',
|
|
|
- 507 => 'Loop Detected',
|
|
|
- 508 => 'Bandwidth Limit Exceeded',
|
|
|
- 509 => 'Not Extended',
|
|
|
- 510 => 'Network Authentication Required',
|
|
|
- 597 => 'Network read timeout error',
|
|
|
- 598 => 'Network connect timeout error',
|
|
|
+ 0 => "Unknown error",
|
|
|
+ 100 => 'Informational: Continue',
|
|
|
+ 101 => 'Informational: Switching Protocols',
|
|
|
+ 102 => 'Informational: Processing',
|
|
|
+ 200 => 'Successful: OK',
|
|
|
+ 201 => 'Successful: Created',
|
|
|
+ 202 => 'Successful: Accepted',
|
|
|
+ 203 => 'Successful: Non-Authoritative Information',
|
|
|
+ 204 => 'Successful: No Content',
|
|
|
+ 205 => 'Successful: Reset Content',
|
|
|
+ 206 => 'Successful: Partial Content',
|
|
|
+ 207 => 'Successful: Multi-Status',
|
|
|
+ 208 => 'Successful: Already Reported',
|
|
|
+ 226 => 'Successful: IM Used',
|
|
|
+ 300 => 'Redirection: Multiple Choices',
|
|
|
+ 301 => 'Redirection: Moved Permanently',
|
|
|
+ 302 => 'Redirection: Found',
|
|
|
+ 303 => 'Redirection: See Other',
|
|
|
+ 304 => 'Redirection: Not Modified',
|
|
|
+ 305 => 'Redirection: Use Proxy',
|
|
|
+ 306 => 'Redirection: Switch Proxy',
|
|
|
+ 307 => 'Redirection: Temporary Redirect',
|
|
|
+ 308 => 'Redirection: Permanent Redirect',
|
|
|
+ 400 => 'Client Error: Bad Request',
|
|
|
+ 401 => 'Client Error: Unauthorized',
|
|
|
+ 402 => 'Client Error: Payment Required',
|
|
|
+ 403 => 'Client Error: Forbidden',
|
|
|
+ 404 => 'Client Error: Not Found',
|
|
|
+ 405 => 'Client Error: Method Not Allowed',
|
|
|
+ 406 => 'Client Error: Not Acceptable',
|
|
|
+ 407 => 'Client Error: Proxy Authentication Required',
|
|
|
+ 408 => 'Client Error: Request Timeout',
|
|
|
+ 409 => 'Client Error: Conflict',
|
|
|
+ 410 => 'Client Error: Gone',
|
|
|
+ 411 => 'Client Error: Length Required',
|
|
|
+ 412 => 'Client Error: Precondition Failed',
|
|
|
+ 413 => 'Client Error: Request Entity Too Large',
|
|
|
+ 414 => 'Client Error: Request-URI Too Long',
|
|
|
+ 415 => 'Client Error: Unsupported Media Type',
|
|
|
+ 416 => 'Client Error: Requested Range Not Satisfiable',
|
|
|
+ 417 => 'Client Error: Expectation Failed',
|
|
|
+ 418 => 'Client Error: I\'m a teapot',
|
|
|
+ 419 => 'Client Error: Authentication Timeout',
|
|
|
+ 420 => 'Client Error: Enhance Your Calm',
|
|
|
+ 420 => 'Client Error: Method Failure',
|
|
|
+ 422 => 'Client Error: Unprocessable Entity',
|
|
|
+ 423 => 'Client Error: Locked',
|
|
|
+ 424 => 'Client Error: Failed Dependency',
|
|
|
+ 424 => 'Client Error: Method Failure',
|
|
|
+ 425 => 'Client Error: Unordered Collection',
|
|
|
+ 426 => 'Client Error: Upgrade Required',
|
|
|
+ 428 => 'Client Error: Precondition Required',
|
|
|
+ 429 => 'Client Error: Too Many Requests',
|
|
|
+ 431 => 'Client Error: Request Header Fields Too Large',
|
|
|
+ 444 => 'Client Error: No Response',
|
|
|
+ 449 => 'Client Error: Retry With',
|
|
|
+ 450 => 'Client Error: Blocked by Windows Parental Controls',
|
|
|
+ 451 => 'Client Error: Redirect',
|
|
|
+ 451 => 'Client Error: Unavailable For Legal Reasons',
|
|
|
+ 494 => 'Client Error: Request Header Too Large',
|
|
|
+ 495 => 'Client Error: Cert Error',
|
|
|
+ 496 => 'Client Error: No Cert',
|
|
|
+ 497 => 'Client Error: HTTP to HTTPS',
|
|
|
+ 499 => 'Client Error: Client Closed Request',
|
|
|
+ 500 => 'Server Error: Internal Server Error',
|
|
|
+ 501 => 'Server Error: Not Implemented',
|
|
|
+ 502 => 'Server Error: Bad Gateway',
|
|
|
+ 503 => 'Server Error: Service Unavailable',
|
|
|
+ 504 => 'Server Error: Gateway Timeout',
|
|
|
+ 505 => 'Server Error: HTTP Version Not Supported',
|
|
|
+ 506 => 'Server Error: Variant Also Negotiates',
|
|
|
+ 507 => 'Server Error: Insufficient Storage',
|
|
|
+ 508 => 'Server Error: Loop Detected',
|
|
|
+ 509 => 'Server Error: Bandwidth Limit Exceeded',
|
|
|
+ 510 => 'Server Error: Not Extended',
|
|
|
+ 511 => 'Server Error: Network Authentication Required',
|
|
|
+ 598 => 'Server Error: Network read timeout error',
|
|
|
+ 599 => 'Server Error: Network connect timeout error'
|
|
|
);
|
|
|
|
|
|
|
|
@@ -110,9 +110,13 @@ namespace Gogs\Lib\Curl\Exception {
|
|
|
* @string $code - the HTTP status code.
|
|
|
* @exception $prev - Previous exceptions
|
|
|
**/
|
|
|
- public function __construct(string $message, int $code = -1, Exception $previous = null) {
|
|
|
+ public function __construct(string $message, int $code = 0, Exception $previous = null) {
|
|
|
$this->response = $message;
|
|
|
- parent::__construct(HTTPUnexpectedResponse::$ecode[$code], $code, $previous);
|
|
|
+ parent::__construct(
|
|
|
+ isset(HTTPUnexpectedResponse::$ecode[$code]) ? HTTPUnexpectedResponse::$ecode[$code] : HTTPUnexpectedResponse::$ecode[0],
|
|
|
+ $code,
|
|
|
+ $previous
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
|