src/http.lua

changeset 16
68a0c983bf49
parent 12
dfa7cb60647e
child 18
b5c4b245e24c
equal deleted inserted replaced
15:3fe9cef6a187 16:68a0c983bf49
108 internal_error = config.debug and error.error and error.error.context.wrapped_error; 108 internal_error = config.debug and error.error and error.error.context.wrapped_error;
109 }); 109 });
110 return r; 110 return r;
111 end 111 end
112 112
113 local function redirect(to, code)
114 code = code or 303;
115 return function (event)
116 if event.request.url.query then
117 event.response.headers.location = to.."?"..event.request.url.query;
118 else
119 event.response.headers.location = to;
120 end
121 return code;
122 end
123 end
124
125 local function size_only(request, data) 113 local function size_only(request, data)
126 request.headers.content_size = #data; 114 request.headers.content_size = #data;
127 return 200; 115 return 200;
128 end 116 end
129 117

mercurial