[前][次][番号順一覧][スレッド一覧]

ruby-changes:46685

From: naruse <ko1@a...>
Date: Sat, 20 May 2017 01:06:27 +0900 (JST)
Subject: [ruby-changes:46685] naruse:r58800 (trunk): Add more HTTP status classes

naruse	2017-05-20 01:06:18 +0900 (Sat, 20 May 2017)

  New Revision: 58800

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58800

  Log:
    Add more HTTP status classes

  Modified files:
    trunk/NEWS
    trunk/lib/net/http/responses.rb
Index: NEWS
===================================================================
--- NEWS	(revision 58799)
+++ NEWS	(revision 58800)
@@ -76,6 +76,9 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L76
 === Stdlib updates (outstanding ones only)
 
 * Net::HTTP
+  * Add more HTTP status classes
+
+* Net::HTTP
   * Net::HTTP#proxy_user and Net::HTTP#proxy_pass now reflects http_proxy
     environment variable if the system's environment variable is multiuser
     safe. [Bug #12921]
Index: lib/net/http/responses.rb
===================================================================
--- lib/net/http/responses.rb	(revision 58799)
+++ lib/net/http/responses.rb	(revision 58800)
@@ -1,5 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/net/http/responses.rb#L1
 # frozen_string_literal: false
 # :stopdoc:
+# https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
 class Net::HTTPUnknownResponse < Net::HTTPResponse
   HAS_BODY = true
   EXCEPTION_TYPE = Net::HTTPError
@@ -169,7 +170,7 @@ end https://github.com/ruby/ruby/blob/trunk/lib/net/http/responses.rb#L170
 class Net::HTTPRequestHeaderFieldsTooLarge < Net::HTTPClientError   # 431 - RFC 6585
   HAS_BODY = true
 end
-class Net::HTTPUnavailableForLegalReasons < Net::HTTPClientError    # 451
+class Net::HTTPUnavailableForLegalReasons < Net::HTTPClientError    # 451 - RFC 7725
   HAS_BODY = true
 end
 # 444 No Response - Nginx
@@ -217,6 +218,7 @@ class Net::HTTPResponse https://github.com/ruby/ruby/blob/trunk/lib/net/http/responses.rb#L218
   CODE_TO_OBJ = {
     '100' => Net::HTTPContinue,
     '101' => Net::HTTPSwitchProtocol,
+    '102' => Net::HTTPProcessing,
 
     '200' => Net::HTTPOK,
     '201' => Net::HTTPCreated,
@@ -226,6 +228,7 @@ class Net::HTTPResponse https://github.com/ruby/ruby/blob/trunk/lib/net/http/responses.rb#L228
     '205' => Net::HTTPResetContent,
     '206' => Net::HTTPPartialContent,
     '207' => Net::HTTPMultiStatus,
+    '208' => Net::HTTPAlreadyReported,
     '226' => Net::HTTPIMUsed,
 
     '300' => Net::HTTPMultipleChoices,
@@ -255,6 +258,7 @@ class Net::HTTPResponse https://github.com/ruby/ruby/blob/trunk/lib/net/http/responses.rb#L258
     '415' => Net::HTTPUnsupportedMediaType,
     '416' => Net::HTTPRequestedRangeNotSatisfiable,
     '417' => Net::HTTPExpectationFailed,
+    '421' => Net::HTTPMisdirectedRequest,
     '422' => Net::HTTPUnprocessableEntity,
     '423' => Net::HTTPLocked,
     '424' => Net::HTTPFailedDependency,
@@ -262,6 +266,7 @@ class Net::HTTPResponse https://github.com/ruby/ruby/blob/trunk/lib/net/http/responses.rb#L266
     '428' => Net::HTTPPreconditionRequired,
     '429' => Net::HTTPTooManyRequests,
     '431' => Net::HTTPRequestHeaderFieldsTooLarge,
+    '451' => Net::HTTPUnavailableForLegalReasons,
 
     '500' => Net::HTTPInternalServerError,
     '501' => Net::HTTPNotImplemented,
@@ -269,7 +274,10 @@ class Net::HTTPResponse https://github.com/ruby/ruby/blob/trunk/lib/net/http/responses.rb#L274
     '503' => Net::HTTPServiceUnavailable,
     '504' => Net::HTTPGatewayTimeOut,
     '505' => Net::HTTPVersionNotSupported,
+    '506' => Net::HTTPVariantAlsoNegotiates,
     '507' => Net::HTTPInsufficientStorage,
+    '508' => Net::HTTPLoopDetected,
+    '510' => Net::HTTPNotExtended,
     '511' => Net::HTTPNetworkAuthenticationRequired,
   }
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]