Project

General

Profile

Feature #6480 ยป additional_http_status_code_from_rfc_6585.patch

humbroll (Sangil Jung), 05/23/2012 05:37 AM

View differences:

lib/webrick/httpstatus.rb (working copy)
88 88
      415 => 'Unsupported Media Type',
89 89
      416 => 'Request Range Not Satisfiable',
90 90
      417 => 'Expectation Failed',
91
      428 => 'Precondition Required',
92
      429 => 'Too Many Requests',
93
      431 => 'Request Header Fields Too Large',
91 94
      500 => 'Internal Server Error',
92 95
      501 => 'Not Implemented',
93 96
      502 => 'Bad Gateway',
94 97
      503 => 'Service Unavailable',
95 98
      504 => 'Gateway Timeout',
96
      505 => 'HTTP Version Not Supported'
99
      505 => 'HTTP Version Not Supported',
100
      511 => 'Network Authentication Required'
97 101
    }
98 102

  
99 103
    # Maps a status code to the corresponding Status class
lib/net/http.rb (working copy)
347 347
  #   HTTPUnsupportedMediaType::            415
348 348
  #   HTTPRequestedRangeNotSatisfiable::    416
349 349
  #   HTTPExpectationFailed::               417
350
  #   HTTPPreconditionRequired::            428
351
  #   HTTPTooManyRequests::                 429
352
  #   HTTPRequestHeaderFieldsTooLarge::     431
350 353
  # HTTPServerError::                    5xx
351 354
  #   HTTPInternalServerError::             500
352 355
  #   HTTPNotImplemented::                  501
......
354 357
  #   HTTPServiceUnavailable::              503
355 358
  #   HTTPGatewayTimeOut::                  504
356 359
  #   HTTPVersionNotSupported::             505
360
  #   HTTPNetworkAuthenticationRequired::   511
357 361
  #
358 362
  # There is also the Net::HTTPBadResponse exception which is raised when
359 363
  # there is a protocol error.
......
2387 2391
  #       415        HTTPUnsupportedMediaType
2388 2392
  #       416        HTTPRequestedRangeNotSatisfiable
2389 2393
  #       417        HTTPExpectationFailed
2394
  #       428        HTTPPreconditionRequired
2395
  #       429        HTTPTooManyRequests
2396
  #       431        HTTPRequestHeaderFieldsTooLarge
2390 2397
  #
2391 2398
  #     5xx        HTTPServerError
2392 2399
  #       500        HTTPInternalServerError
......
2395 2402
  #       503        HTTPServiceUnavailable
2396 2403
  #       504        HTTPGatewayTimeOut
2397 2404
  #       505        HTTPVersionNotSupported
2405
  #       511        HTTPNetworkAuthenticationRequired
2398 2406
  #
2399 2407
  #     xxx        HTTPUnknownResponse
2400 2408
  #
......
2544 2552
  class HTTPExpectationFailed < HTTPClientError             # 417
2545 2553
    HAS_BODY = true
2546 2554
  end
2555
  class HTTPPreconditionRequired < HTTPClientError          # 428
2556
    HAS_BODY = true
2557
  end
2558
  class HTTPTooManyRequests < HTTPClientError               # 429
2559
    HAS_BODY = true
2560
  end
2561
  class HTTPRequestHeaderFieldsTooLarge < HTTPClientError   # 431
2562
    HAS_BODY = true
2563
  end
2547 2564

  
2548
  class HTTPInternalServerError < HTTPServerError   # 500
2565
  class HTTPInternalServerError < HTTPServerError           # 500
2549 2566
    HAS_BODY = true
2550 2567
  end
2551
  class HTTPNotImplemented < HTTPServerError        # 501
2568
  class HTTPNotImplemented < HTTPServerError                # 501
2552 2569
    HAS_BODY = true
2553 2570
  end
2554
  class HTTPBadGateway < HTTPServerError            # 502
2571
  class HTTPBadGateway < HTTPServerError                    # 502
2555 2572
    HAS_BODY = true
2556 2573
  end
2557
  class HTTPServiceUnavailable < HTTPServerError    # 503
2574
  class HTTPServiceUnavailable < HTTPServerError            # 503
2558 2575
    HAS_BODY = true
2559 2576
  end
2560
  class HTTPGatewayTimeOut < HTTPServerError        # 504
2577
  class HTTPGatewayTimeOut < HTTPServerError                # 504
2561 2578
    HAS_BODY = true
2562 2579
  end
2563
  class HTTPVersionNotSupported < HTTPServerError   # 505
2580
  class HTTPVersionNotSupported < HTTPServerError           # 505
2564 2581
    HAS_BODY = true
2565 2582
  end
2583
  class HTTPNetworkAuthenticationRequired < HTTPServerError # 511
2584
    HAS_BODY = true
2585
  end
2566 2586

  
2567 2587
  # :startdoc:
2568 2588

  
......
2614 2634
      '415' => HTTPUnsupportedMediaType,
2615 2635
      '416' => HTTPRequestedRangeNotSatisfiable,
2616 2636
      '417' => HTTPExpectationFailed,
2637
      '428' => HTTPPreconditionRequired,
2638
      '429' => HTTPTooManyRequests,
2639
      '431' => HTTPRequestHeaderFieldsTooLarge,
2617 2640

  
2618 2641
      '500' => HTTPInternalServerError,
2619 2642
      '501' => HTTPNotImplemented,
2620 2643
      '502' => HTTPBadGateway,
2621 2644
      '503' => HTTPServiceUnavailable,
2622 2645
      '504' => HTTPGatewayTimeOut,
2623
      '505' => HTTPVersionNotSupported
2646
      '505' => HTTPVersionNotSupported,
2647
      '511' => HTTPNetworkAuthenticationRequired
2624 2648
    }
2625 2649

  
2626 2650
    class << HTTPResponse