webmcp

annotate framework/env/request/set_status.lua @ 60:f2fe38a54504

Bugfix in function encode.mime.mailbox_list_header_line(...), which caused arguments to be modified
author jbe
date Mon Mar 05 19:08:49 2012 +0100 (2012-03-05)
parents 9fdfb27f8e67
children
rev   line source
jbe/bsw@0 1 --[[--
jbe/bsw@0 2 request.set_status(
jbe/bsw@0 3 str -- string containing a HTTP status code, e.g. "404 Not Found"
jbe/bsw@0 4 )
jbe/bsw@0 5
jbe/bsw@0 6 Calling this function causes a HTTP status different from 200 OK (or in case of error different from 500 Internal Server Error) to be sent to the browser.
jbe/bsw@0 7
jbe/bsw@0 8 --]]--
jbe/bsw@0 9
jbe/bsw@0 10 function request.set_status(str)
jbe/bsw@0 11 if str then
jbe/bsw@0 12 local t = type(str)
jbe/bsw@0 13 if type(str) == "number" then
jbe/bsw@0 14 str = tostring(str)
jbe/bsw@0 15 elseif type(str) ~= "string" then
jbe/bsw@0 16 error("request.set_status(...) must be called with a string as parameter.")
jbe/bsw@0 17 end
jbe/bsw@0 18 request._status = str
jbe/bsw@0 19 else
jbe/bsw@0 20 request._status = nil
jbe/bsw@0 21 end
jbe/bsw@0 22 end

Impressum / About Us