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

ruby-changes:24017

From: knu <ko1@a...>
Date: Thu, 14 Jun 2012 00:20:38 +0900 (JST)
Subject: [ruby-changes:24017] knu:r36068 (trunk): * lib/net/http/responses.rb, lib/webrick/httpstatus.rb: Add HTTP

knu	2012-06-14 00:20:27 +0900 (Thu, 14 Jun 2012)

  New Revision: 36068

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36068

  Log:
    * lib/net/http/responses.rb, lib/webrick/httpstatus.rb: Add HTTP
      response codes added in RFCs 2817 and 4918.  [ruby-core:45547]
      [Feature #6569]
    
    * lib/net/http/responses.rb: Rename Net::HTTPMultipleChoice to
      Net::HTTPMultipleChoices, leaving the former as alias to the
      latter for backward compatibitily.  [ruby-core:45547]
      [Feature #6569]
    
    * lib/net/http/responses.rb: Add comments about unused,
      still-in-draft and private extension response codes.
      [ruby-core:45547] [Feature #6569]

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/http/responses.rb
    trunk/lib/net/http.rb
    trunk/lib/webrick/httpstatus.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36067)
+++ ChangeLog	(revision 36068)
@@ -1,3 +1,18 @@
+Thu Jun 14 00:16:59 2012  Akinori MUSHA  <knu@i...>
+
+	* lib/net/http/responses.rb, lib/webrick/httpstatus.rb: Add HTTP
+	  response codes added in RFCs 2817 and 4918.  [ruby-core:45547]
+	  [Feature #6569]
+
+	* lib/net/http/responses.rb: Rename Net::HTTPMultipleChoice to
+	  Net::HTTPMultipleChoices, leaving the former as alias to the
+	  latter for backward compatibitily.  [ruby-core:45547]
+	  [Feature #6569]
+
+	* lib/net/http/responses.rb: Add comments about unused,
+	  still-in-draft and private extension response codes.
+	  [ruby-core:45547] [Feature #6569]
+
 Wed Jun 13 22:44:32 2012  Naohisa Goto  <ngotogenome@g...>
 
 	* test/dl/test_func.rb (test_qsort1, test_qsort2): use TYPE_SIZE_T
Index: lib/webrick/httpstatus.rb
===================================================================
--- lib/webrick/httpstatus.rb	(revision 36067)
+++ lib/webrick/httpstatus.rb	(revision 36068)
@@ -63,6 +63,7 @@
       204 => 'No Content',
       205 => 'Reset Content',
       206 => 'Partial Content',
+      207 => 'Multi-Status',
       300 => 'Multiple Choices',
       301 => 'Moved Permanently',
       302 => 'Found',
@@ -88,6 +89,10 @@
       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',
@@ -97,6 +102,7 @@
       503 => 'Service Unavailable',
       504 => 'Gateway Timeout',
       505 => 'HTTP Version Not Supported',
+      507 => 'Insufficient Storage',
       511 => 'Network Authentication Required',
     }
 
Index: lib/net/http/responses.rb
===================================================================
--- lib/net/http/responses.rb	(revision 36067)
+++ lib/net/http/responses.rb	(revision 36068)
@@ -30,6 +30,7 @@
 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
@@ -52,10 +53,16 @@
 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
@@ -72,10 +79,11 @@
 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
@@ -132,6 +140,21 @@
 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
@@ -141,6 +164,10 @@
 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
@@ -160,6 +187,13 @@
 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
@@ -183,8 +217,9 @@
     '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,
@@ -210,6 +245,10 @@
     '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,
@@ -220,6 +259,7 @@
     '503' => Net::HTTPServiceUnavailable,
     '504' => Net::HTTPGatewayTimeOut,
     '505' => Net::HTTPVersionNotSupported,
+    '507' => Net::HTTPInsufficientStorage,
     '511' => Net::HTTPNetworkAuthenticationRequired,
   }
 end
Index: lib/net/http.rb
===================================================================
--- lib/net/http.rb	(revision 36067)
+++ lib/net/http.rb	(revision 36068)
@@ -320,8 +320,9 @@
   #   HTTPNoContent::                       204
   #   HTTPResetContent::                    205
   #   HTTPPartialContent::                  206
+  #   HTTPMultiStatus::                     207
   # HTTPRedirection::                    3xx
-  #   HTTPMultipleChoice::                  300
+  #   HTTPMultipleChoices::                 300
   #   HTTPMovedPermanently::                301
   #   HTTPFound::                           302
   #   HTTPSeeOther::                        303
@@ -347,6 +348,10 @@
   #   HTTPUnsupportedMediaType::            415
   #   HTTPRequestedRangeNotSatisfiable::    416
   #   HTTPExpectationFailed::               417
+  #   HTTPUnprocessableEntity::             422
+  #   HTTPLocked::                          423
+  #   HTTPFailedDependency::                424
+  #   HTTPUpgradeRequired::                 426
   #   HTTPPreconditionRequired::            428
   #   HTTPTooManyRequests::                 429
   #   HTTPRequestHeaderFieldsTooLarge::     431
@@ -357,6 +362,7 @@
   #   HTTPServiceUnavailable::              503
   #   HTTPGatewayTimeOut::                  504
   #   HTTPVersionNotSupported::             505
+  #   HTTPInsufficientStorage::             507
   #   HTTPNetworkAuthenticationRequired::   511
   #
   # There is also the Net::HTTPBadResponse exception which is raised when

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

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