Permalink
Browse files

update HTTP status codes to IETF RFC 7231

  • Loading branch information...
tonyta committed Nov 7, 2014
1 parent 575bbcb commit be28c6a2ac152fe4adfbef71f3db9f4200df89e8
Showing with 7 additions and 9 deletions.
  1. +7 −9 lib/rack/utils.rb
View
@@ -567,9 +567,9 @@ def to_params_hash
# Every standard HTTP code mapped to the appropriate message.
# Generated with:
- # ruby -ropen-uri -rnokogiri -e "Nokogiri::XML(open(
- # 'http://www.iana.org/assignments/http-status-codes/http-status-codes.xml')).css('record').each{|r|
- # name = r.css('description').text; puts %Q[#{r.css('value').text} => '#{name}',] unless name == 'Unassigned' }"
+ # curl -s https://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv | \
+ # ruby -ne 'm = /^(\d{3}),(?!Unassigned|\(Unused\))([^,]+)/.match($_) and \
+ # puts "#{m[1]} => \x27#{m[2].strip}\x27,"'
HTTP_STATUS_CODES = {
100 => 'Continue',
101 => 'Switching Protocols',
@@ -590,7 +590,6 @@ def to_params_hash
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
- 306 => 'Reserved',
307 => 'Temporary Redirect',
308 => 'Permanent Redirect',
400 => 'Bad Request',
@@ -606,12 +605,11 @@ def to_params_hash
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
- 413 => 'Request Entity Too Large',
- 414 => 'Request-URI Too Long',
+ 413 => 'Payload Too Large',
+ 414 => 'URI Too Long',
415 => 'Unsupported Media Type',
- 416 => 'Requested Range Not Satisfiable',
+ 416 => 'Range Not Satisfiable',
417 => 'Expectation Failed',
- 418 => 'I\'m a teapot',
422 => 'Unprocessable Entity',
423 => 'Locked',
424 => 'Failed Dependency',
@@ -625,7 +623,7 @@ def to_params_hash
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
- 506 => 'Variant Also Negotiates (Experimental)',
+ 506 => 'Variant Also Negotiates',
507 => 'Insufficient Storage',
508 => 'Loop Detected',
510 => 'Not Extended',

0 comments on commit be28c6a

Please sign in to comment.