Skip to content

Commit 3364f3b

Browse files
akzhanbcardiff
authored andcommittedMay 18, 2017
Extend known HTTP default status messages by RFC 2518, RFC 5842, RFC 2324 etc. (#4419)
Heavily inpsired by CPAN HTTP::Status module.
1 parent af61a81 commit 3364f3b

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed
 

Diff for: ‎src/http/common.cr

+15-5
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,16 @@ module HTTP
295295
case status_code
296296
when 100 then "Continue"
297297
when 101 then "Switching Protocols"
298+
when 102 then "Processing" # RFC 2518 (WebDAV)
298299
when 200 then "OK"
299300
when 201 then "Created"
300301
when 202 then "Accepted"
301302
when 203 then "Non-Authoritative Information"
302303
when 204 then "No Content"
303304
when 205 then "Reset Content"
304305
when 206 then "Partial Content"
306+
when 207 then "Multi-Status" # RFC 2518 (WebDAV)
307+
when 208 then "Already Reported" # RFC 5842
305308
when 226 then "IM Used"
306309
when 300 then "Multiple Choices"
307310
when 301 then "Moved Permanently"
@@ -310,7 +313,7 @@ module HTTP
310313
when 304 then "Not Modified"
311314
when 305 then "Use Proxy"
312315
when 307 then "Temporary Redirect"
313-
when 308 then "Permanent Redirect"
316+
when 308 then "Permanent Redirect" # RFC 7238
314317
when 400 then "Bad Request"
315318
when 401 then "Unauthorized"
316319
when 402 then "Payment Required"
@@ -329,21 +332,28 @@ module HTTP
329332
when 415 then "Unsupported Media Type"
330333
when 416 then "Requested Range Not Satisfiable"
331334
when 417 then "Expectation Failed"
335+
when 418 then "I'm a teapot" # RFC 2324
332336
when 421 then "Misdirected Request"
333-
when 423 then "Locked"
334-
when 426 then "Upgrade Required"
337+
when 422 then "Unprocessable Entity" # RFC 2518 (WebDAV)
338+
when 423 then "Locked" # RFC 2518 (WebDAV)
339+
when 424 then "Failed Dependency" # RFC 2518 (WebDAV)
340+
when 426 then "Upgrade Required" # RFC 2817
335341
when 428 then "Precondition Required"
336342
when 429 then "Too Many Requests"
337343
when 431 then "Request Header Fields Too Large"
344+
when 449 then "Retry With" # unofficial Microsoft
338345
when 451 then "Unavailable For Legal Reasons"
339346
when 500 then "Internal Server Error"
340347
when 501 then "Not Implemented"
341348
when 502 then "Bad Gateway"
342349
when 503 then "Service Unavailable"
343350
when 504 then "Gateway Timeout"
344351
when 505 then "HTTP Version Not Supported"
345-
when 506 then "Variant Also Negotiates"
346-
when 510 then "Not Extended"
352+
when 506 then "Variant Also Negotiates" # RFC 2295
353+
when 507 then "Insufficient Storage" # RFC 2518 (WebDAV)
354+
when 509 then "Bandwidth Limit Exceeded" # unofficial
355+
when 510 then "Not Extended" # RFC 2774
356+
when 511 then "Network Authentication Required"
347357
else ""
348358
end
349359
end

0 commit comments

Comments
 (0)
Please sign in to comment.