From 4a5732e210bb7ae2d8c7d1710131ce06375423ed Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Wed, 9 Nov 2022 22:08:51 +0000 Subject: [PATCH 1/2] Prettify class hierarchies in Net::HTTP --- lib/net/http.rb | 196 +++++++++++++++++++++++++----------------------- 1 file changed, 104 insertions(+), 92 deletions(-) diff --git a/lib/net/http.rb b/lib/net/http.rb index b602d2d0..80dfc95d 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -298,98 +298,110 @@ class HTTPHeaderSyntaxError < StandardError; end # # Compression can be disabled through the Accept-Encoding: identity header. # - # == HTTP Request Classes - # - # Here is the HTTP request class hierarchy. - # - # * Net::HTTPRequest - # * Net::HTTP::Get - # * Net::HTTP::Head - # * Net::HTTP::Post - # * Net::HTTP::Patch - # * Net::HTTP::Put - # * Net::HTTP::Proppatch - # * Net::HTTP::Lock - # * Net::HTTP::Unlock - # * Net::HTTP::Options - # * Net::HTTP::Propfind - # * Net::HTTP::Delete - # * Net::HTTP::Move - # * Net::HTTP::Copy - # * Net::HTTP::Mkcol - # * Net::HTTP::Trace - # - # == HTTP Response Classes - # - # Here is HTTP response class hierarchy. All classes are defined in Net - # module and are subclasses of Net::HTTPResponse. - # - # HTTPUnknownResponse:: For unhandled HTTP extensions - # HTTPInformation:: 1xx - # HTTPContinue:: 100 - # HTTPSwitchProtocol:: 101 - # HTTPProcessing:: 102 - # HTTPEarlyHints:: 103 - # HTTPSuccess:: 2xx - # HTTPOK:: 200 - # HTTPCreated:: 201 - # HTTPAccepted:: 202 - # HTTPNonAuthoritativeInformation:: 203 - # HTTPNoContent:: 204 - # HTTPResetContent:: 205 - # HTTPPartialContent:: 206 - # HTTPMultiStatus:: 207 - # HTTPAlreadyReported:: 208 - # HTTPIMUsed:: 226 - # HTTPRedirection:: 3xx - # HTTPMultipleChoices:: 300 - # HTTPMovedPermanently:: 301 - # HTTPFound:: 302 - # HTTPSeeOther:: 303 - # HTTPNotModified:: 304 - # HTTPUseProxy:: 305 - # HTTPTemporaryRedirect:: 307 - # HTTPPermanentRedirect:: 308 - # HTTPClientError:: 4xx - # HTTPBadRequest:: 400 - # HTTPUnauthorized:: 401 - # HTTPPaymentRequired:: 402 - # HTTPForbidden:: 403 - # HTTPNotFound:: 404 - # HTTPMethodNotAllowed:: 405 - # HTTPNotAcceptable:: 406 - # HTTPProxyAuthenticationRequired:: 407 - # HTTPRequestTimeOut:: 408 - # HTTPConflict:: 409 - # HTTPGone:: 410 - # HTTPLengthRequired:: 411 - # HTTPPreconditionFailed:: 412 - # HTTPRequestEntityTooLarge:: 413 - # HTTPRequestURITooLong:: 414 - # HTTPUnsupportedMediaType:: 415 - # HTTPRequestedRangeNotSatisfiable:: 416 - # HTTPExpectationFailed:: 417 - # HTTPMisdirectedRequest:: 421 - # HTTPUnprocessableEntity:: 422 - # HTTPLocked:: 423 - # HTTPFailedDependency:: 424 - # HTTPUpgradeRequired:: 426 - # HTTPPreconditionRequired:: 428 - # HTTPTooManyRequests:: 429 - # HTTPRequestHeaderFieldsTooLarge:: 431 - # HTTPUnavailableForLegalReasons:: 451 - # HTTPServerError:: 5xx - # HTTPInternalServerError:: 500 - # HTTPNotImplemented:: 501 - # HTTPBadGateway:: 502 - # HTTPServiceUnavailable:: 503 - # HTTPGatewayTimeOut:: 504 - # HTTPVersionNotSupported:: 505 - # HTTPVariantAlsoNegotiates:: 506 - # HTTPInsufficientStorage:: 507 - # HTTPLoopDetected:: 508 - # HTTPNotExtended:: 510 - # HTTPNetworkAuthenticationRequired:: 511 + # == \HTTP Request Classes + # + # Here is the hierarchy of \HTTP request classes + # + # - Net::HTTPRequest + # + # - Net::HTTP::Get + # - Net::HTTP::Head + # - Net::HTTP::Post + # - Net::HTTP::Patch + # - Net::HTTP::Put + # - Net::HTTP::Proppatch + # - Net::HTTP::Lock + # - Net::HTTP::Unlock + # - Net::HTTP::Options + # - Net::HTTP::Propfind + # - Net::HTTP::Delete + # - Net::HTTP::Move + # - Net::HTTP::Copy + # - Net::HTTP::Mkcol + # - Net::HTTP::Trace + # + # == \HTTP Response Classes + # + # Here is the \HTTP response class hierarchy (with status codes): + # + # - Net::HTTPResponse: + # + # - Net::HTTPUnknownResponse (for unhandled \HTTP extensions). + # + # - Net::HTTPInformation: + # + # - Net::HTTPContinue (100) + # - Net::HTTPSwitchProtocol (101) + # - Net::HTTPProcessing (102) + # - Net::HTTPEarlyHints (103) + # + # - Net::HTTPSuccess: + # + # - Net::HTTPOK (200) + # - Net::HTTPCreated (201) + # - Net::HTTPAccepted (202) + # - Net::HTTPNonAuthoritativeInformation (203) + # - Net::HTTPNoContent (204) + # - Net::HTTPResetContent (205) + # - Net::HTTPPartialContent (206) + # - Net::HTTPMultiStatus (207) + # - Net::HTTPAlreadyReported (208) + # - Net::HTTPIMUsed (226) + # + # - HTTPRedirection: + # + # - Net::HTTPMultipleChoices (300) + # - Net::HTTPMovedPermanently (301) + # - Net::HTTPFound (302) + # - Net::HTTPSeeOther (303) + # - Net::HTTPNotModified (304) + # - Net::HTTPUseProxy (305) + # - Net::HTTPTemporaryRedirect (307) + # - Net::HTTPPermanentRedirect (308) + # + # - Net::HTTPClientError: + # + # - Net::HTTPBadRequest (400) + # - Net::HTTPUnauthorized (401) + # - Net::HTTPPaymentRequired (402) + # - Net::HTTPForbidden (403) + # - Net::HTTPNotFound (404) + # - Net::HTTPMethodNotAllowed (405) + # - Net::HTTPNotAcceptable (406) + # - Net::HTTPProxyAuthenticationRequired (407) + # - Net::HTTPRequestTimeOut (408) + # - Net::HTTPConflict (409) + # - Net::HTTPGone (410) + # - Net::HTTPLengthRequired (411) + # - Net::HTTPPreconditionFailed (412) + # - Net::HTTPRequestEntityTooLarge (413) + # - Net::HTTPRequestURITooLong (414) + # - Net::HTTPUnsupportedMediaType (415) + # - Net::HTTPRequestedRangeNotSatisfiable (416) + # - Net::HTTPExpectationFailed (417) + # - Net::HTTPMisdirectedRequest (421) + # - Net::HTTPUnprocessableEntity (422) + # - Net::HTTPLocked (423) + # - Net::HTTPFailedDependency (424) + # - Net::HTTPUpgradeRequired (426) + # - Net::HTTPPreconditionRequired (428) + # - Net::HTTPTooManyRequests (429) + # - Net::HTTPRequestHeaderFieldsTooLarge (431) + # - Net::HTTPUnavailableForLegalReasons (451) + # + # - Net::HTTPServerError: + # + # - Net::HTTPInternalServerError (500) + # - Net::HTTPNotImplemented (501) + # - Net::HTTPBadGateway (502) + # - Net::HTTPServiceUnavailable (503) + # - Net::HTTPGatewayTimeOut (504) + # - Net::HTTPVersionNotSupported (505) + # - Net::HTTPVariantAlsoNegotiates (506) + # - Net::HTTPInsufficientStorage (507) + # - Net::HTTPLoopDetected (508) + # - Net::HTTPNotExtended (510) + # - Net::HTTPNetworkAuthenticationRequired (511) # # There is also the Net::HTTPBadResponse exception which is raised when # there is a protocol error. From 16d042fad6cf9697183b88360a39b1ffe88ffa10 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Thu, 10 Nov 2022 09:36:50 -0600 Subject: [PATCH 2/2] Update lib/net/http.rb Co-authored-by: Peter Zhu --- lib/net/http.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/http.rb b/lib/net/http.rb index 80dfc95d..16137ceb 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -348,7 +348,7 @@ class HTTPHeaderSyntaxError < StandardError; end # - Net::HTTPAlreadyReported (208) # - Net::HTTPIMUsed (226) # - # - HTTPRedirection: + # - Net::HTTPRedirection: # # - Net::HTTPMultipleChoices (300) # - Net::HTTPMovedPermanently (301)