From 54ae664847c8f00b3b1f68aaa13d0ac37319a9f6 Mon Sep 17 00:00:00 2001 From: Halfdan Mouritzen Date: Mon, 21 Jan 2013 15:09:39 +0100 Subject: http.server: add more HTTP status codes --- lem/http/server.lua | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/lem/http/server.lua b/lem/http/server.lua index 8e03b8a..e6cb088 100644 --- a/lem/http/server.lua +++ b/lem/http/server.lua @@ -1,6 +1,7 @@ -- -- This file is part of LEM, a Lua Event Machine. -- Copyright 2011-2013 Emil Renner Berthing +-- Copyright 2013 Halfdan Mouritzen -- -- LEM is free software: you can redistribute it and/or modify it -- under the terms of the GNU Lesser General Public License as @@ -32,10 +33,12 @@ require 'lem.http' local M = {} local status_string = { + -- 1xx Informational [100] = '100 Continue', [101] = '101 Switching Protocols', [102] = '102 Processing', -- WebDAV + -- 2xx Success [200] = '200 OK', [201] = '201 Created', [202] = '202 Accepted', @@ -44,7 +47,11 @@ local status_string = { [205] = '205 Reset Content', [206] = '206 Partial Content', [207] = '207 Multi-Status', -- WebDAV + [208] = '208 Already Reported', -- WebDAV + [226] = '226 IM Used', + [230] = '230 Authentication Successfull', + -- 3xx Redirection [300] = '300 Multiple Choices', [301] = '301 Moved Permanently', [302] = '302 Found', @@ -53,22 +60,53 @@ local status_string = { [305] = '305 Use Proxy', [306] = '306 Switch Proxy', [307] = '307 Temporary Redirect', + [308] = '308 Permanent Redirect', + -- 4xx Client Error [400] = '400 Bad Request', [401] = '401 Unauthorized', [402] = '402 Payment Required', [403] = '403 Forbidden', [404] = '404 Not Found', [405] = '405 Method Not Allowed', - -- ... + [406] = '406 Not Acceptable', + [407] = '407 Proxy Authentication Required', + [408] = '408 Request Timeout', + [409] = '409 Conflict', + [410] = '410 Gone', + [411] = '411 Length Required', + [412] = '412 Precondition Failed', + [413] = '413 Request Entity Too Large', + [414] = '414 Request-URI Too Long', + [415] = '415 Unsupported Media Type', + [416] = '416 Requested Range Not Satisfiable', [417] = '417 Expectation Failed', + -- ... + [422] = '422 Unprocessable Entity', -- WebDAV + [423] = '423 Locked', -- WebDAV + [424] = '424 Failed Dependency', -- WebDAV + -- ... + [426] = '426 Upgrade Required', + [428] = '428 Precondition Required', + [429] = '429 Too Many Requests', + [431] = '431 Request Header Fields Too Large', + -- 5xx Server Error [500] = '500 Internal Server Error', [501] = '501 Not Implemented', - -- ... + [502] = '502 Bad Gateway', + [503] = '503 Service Unavailable', + [504] = '504 Gateway Timeout', [505] = '505 HTTP Version Not Supported', + [506] = '506 Variant Also Negotiates', + [507] = '507 Insufficient Storage', -- WebDAV + [508] = '508 Loop Detected', -- WebDAV -- ... + [510] = '510 Not Extended', + [511] = '511 Network Authentication Required', + [531] = '531 Access Denied', } + M.status_string = status_string function M.not_found(req, res) -- cgit v1.2.1