Project

General

Profile

Feature #6569 ยป 0001-lib-net-http-responses.rb-lib-webrick-httpstatus.rb-.patch

knu (Akinori MUSHA), 06/12/2012 01:15 AM

View differences:

ChangeLog
Sun Jun 10 19:04:19 2012 Akinori MUSHA <knu@iDaemons.org>
* lib/net/http/responses.rb, lib/webrick/httpstatus.rb: Add HTTP
response codes added in RFCs 2817 and 4918.
* lib/net/http/responses.rb: Rename Net::HTTPMultipleChoice to
Net::HTTPMultipleChoices, leaving the former as alias to the
latter for backward compatibitily.
* lib/net/http/responses.rb: Add comments about unused,
still-in-draft and private extension response codes.
Mon Jun 11 06:31:33 2012 Tanaka Akira <akr@fsij.org>
* process.c (rb_proc_exec_n): revert the function removed at r35889.
lib/net/http.rb
# HTTPNoContent:: 204
# HTTPResetContent:: 205
# HTTPPartialContent:: 206
# HTTPMultiStatus:: 207
# HTTPRedirection:: 3xx
# HTTPMultipleChoice:: 300
# HTTPMultipleChoices:: 300
# HTTPMovedPermanently:: 301
# HTTPFound:: 302
# HTTPSeeOther:: 303
......
# HTTPUnsupportedMediaType:: 415
# HTTPRequestedRangeNotSatisfiable:: 416
# HTTPExpectationFailed:: 417
# HTTPUnprocessableEntity:: 422
# HTTPLocked:: 423
# HTTPFailedDependency:: 424
# HTTPUpgradeRequired:: 426
# HTTPPreconditionRequired:: 428
# HTTPTooManyRequests:: 429
# HTTPRequestHeaderFieldsTooLarge:: 431
......
# HTTPServiceUnavailable:: 503
# HTTPGatewayTimeOut:: 504
# HTTPVersionNotSupported:: 505
# HTTPInsufficientStorage:: 507
# HTTPNetworkAuthenticationRequired:: 511
#
# There is also the Net::HTTPBadResponse exception which is raised when
lib/net/http/responses.rb
class Net::HTTPSwitchProtocol < Net::HTTPInformation # 101
HAS_BODY = false
end
# 102 - RFC 2518; removed in RFC 4918
class Net::HTTPOK < Net::HTTPSuccess # 200
HAS_BODY = true
......
class Net::HTTPPartialContent < Net::HTTPSuccess # 206
HAS_BODY = true
end
class Net::HTTPMultiStatus < Net::HTTPSuccess # 207 - RFC 4918
HAS_BODY = true
end
# 208 Already Reported - RFC 5842; experimental
# 226 IM Used - RFC 3229; no famous implementation known
class Net::HTTPMultipleChoice < Net::HTTPRedirection # 300
class Net::HTTPMultipleChoices < Net::HTTPRedirection # 300
HAS_BODY = true
end
Net::HTTPMultipleChoice = Net::HTTPMultipleChoices
class Net::HTTPMovedPermanently < Net::HTTPRedirection # 301
HAS_BODY = true
end
......
class Net::HTTPUseProxy < Net::HTTPRedirection # 305
HAS_BODY = false
end
# 306 unused
# 306 Switch Proxy - no longer unused
class Net::HTTPTemporaryRedirect < Net::HTTPRedirection # 307
HAS_BODY = true
end
# 308 Permanent Redirect - in draft
class Net::HTTPBadRequest < Net::HTTPClientError # 400
HAS_BODY = true
......
class Net::HTTPExpectationFailed < Net::HTTPClientError # 417
HAS_BODY = true
end
# 418 I'm a teapot - RFC 2324; a joke RFC
# 420 Enhance Your Calm - Twitter
class Net::HTTPUnprocessableEntity < Net::HTTPSuccess # 422 - RFC 4918
HAS_BODY = true
end
class Net::HTTPLocked < Net::HTTPSuccess # 423 - RFC 4918
HAS_BODY = true
end
class Net::HTTPFailedDependency < Net::HTTPSuccess # 424 - RFC 4918
HAS_BODY = true
end
# 425 Unordered Collection - existed only in draft
class Net::HTTPUpgradeRequired < Net::HTTPSuccess # 426 - RFC 2817
HAS_BODY = true
end
class Net::HTTPPreconditionRequired < Net::HTTPClientError # 428 - RFC 6585
HAS_BODY = true
end
......
class Net::HTTPRequestHeaderFieldsTooLarge < Net::HTTPClientError # 431 - RFC 6585
HAS_BODY = true
end
# 444 No Response - Nginx
# 449 Retry With - Microsoft
# 450 Blocked by Windows Parental Controls - Microsoft
# 499 Client Closed Request - Nginx
class Net::HTTPInternalServerError < Net::HTTPServerError # 500
HAS_BODY = true
......
class Net::HTTPVersionNotSupported < Net::HTTPServerError # 505
HAS_BODY = true
end
# 506 Variant Also Negotiates - RFC 2295; experimental
class Net::HTTPInsufficientStorage < Net::HTTPServerError # 507 - RFC 4918
HAS_BODY = true
end
# 508 Loop Detected - RFC 5842; experimental
# 509 Bandwidth Limit Exceeded - Apache bw/limited extension
# 510 Not Extended - RFC 2774; experimental
class Net::HTTPNetworkAuthenticationRequired < Net::HTTPServerError # 511 - RFC 6585
HAS_BODY = true
end
......
'204' => Net::HTTPNoContent,
'205' => Net::HTTPResetContent,
'206' => Net::HTTPPartialContent,
'207' => Net::HTTPMultiStatus,
'300' => Net::HTTPMultipleChoice,
'300' => Net::HTTPMultipleChoices,
'301' => Net::HTTPMovedPermanently,
'302' => Net::HTTPFound,
'303' => Net::HTTPSeeOther,
......
'415' => Net::HTTPUnsupportedMediaType,
'416' => Net::HTTPRequestedRangeNotSatisfiable,
'417' => Net::HTTPExpectationFailed,
'422' => Net::HTTPUnprocessableEntity,
'423' => Net::HTTPLocked,
'424' => Net::HTTPFailedDependency,
'426' => Net::HTTPUpgradeRequired,
'428' => Net::HTTPPreconditionRequired,
'429' => Net::HTTPTooManyRequests,
'431' => Net::HTTPRequestHeaderFieldsTooLarge,
......
'503' => Net::HTTPServiceUnavailable,
'504' => Net::HTTPGatewayTimeOut,
'505' => Net::HTTPVersionNotSupported,
'507' => Net::HTTPInsufficientStorage,
'511' => Net::HTTPNetworkAuthenticationRequired,
}
end
lib/webrick/httpstatus.rb
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
207 => 'Multi-Status',
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
......
415 => 'Unsupported Media Type',
416 => 'Request Range Not Satisfiable',
417 => 'Expectation Failed',
422 => 'Unprocessable Entity',
423 => 'Locked',
424 => 'Failed Dependency',
426 => 'Upgrade Required',
428 => 'Precondition Required',
429 => 'Too Many Requests',
431 => 'Request Header Fields Too Large',
......
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
507 => 'Insufficient Storage',
511 => 'Network Authentication Required',
}
    (1-1/1)