Module: Cougar::HttpStatuses

Defined in:
lib/cougar/http_statuses.rb

Constant Summary collapse

STATUSES =
{
  100 => 'Continue',
  101 => 'Switching Protocols',
  200 => 'OK',
  201 => 'Created',
  202 => 'Accepted',
  203 => 'Non-Authoritative Information',
  204 => 'No Content',
  205 => 'Reset Content',
  206 => 'Partial Content',
  207 => 'Multi-Status',
  300 => 'Multiple Choices',
  301 => 'Moved Permanently',
  302 => 'Found',
  303 => 'See Other',
  304 => 'Not Modified',
  305 => 'Use Proxy',
  307 => 'Temporary Redirect',
  400 => 'Bad Request',
  401 => 'Unauthorized',
  402 => 'Payment Required',
  403 => 'Forbidden',
  404 => 'Not Found',
  405 => 'Method Not Allowed',
  406 => 'Not Acceptable',
  407 => 'Proxy Authentication Required',
  408 => 'Request Timeout',
  409 => 'Conflict',
  410 => 'Gone',
  411 => 'Length Required',
  412 => 'Precondition Failed',
  413 => 'Request Entity Too Large',
  414 => 'Request-URI Too Large',
  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',
  451 => 'Unavailable For Legal Reasons',
  500 => 'Internal Server Error',
  501 => 'Not Implemented',
  502 => 'Bad Gateway',
  503 => 'Service Unavailable',
  504 => 'Gateway Timeout',
  505 => 'HTTP Version Not Supported',
  507 => 'Insufficient Storage',
  511 => 'Network Authentication Required',
}.freeze
STATUS_LINES_11 =
STATUSES.to_h do |code, text|
  [code, -"HTTP/1.1 #{code} #{text}\r\n"]
end.freeze
STATUS_LINES_10 =
STATUSES.to_h do |code, text|
  [code, -"HTTP/1.0 #{code} #{text}\r\n"]
end.freeze

Class Method Summary collapse

Class Method Details

.status_line_10(code) ⇒ Object



75
76
77
# File 'lib/cougar/http_statuses.rb', line 75

def self.status_line_10(code)
  STATUS_LINES_10[code]
end

.status_line_11(code) ⇒ Object



71
72
73
# File 'lib/cougar/http_statuses.rb', line 71

def self.status_line_11(code)
  STATUS_LINES_11[code]
end

.text_for(code) ⇒ Object



67
68
69
# File 'lib/cougar/http_statuses.rb', line 67

def self.text_for(code)
  STATUSES[code] || "Unknown"
end