Mercurial Hosting > luan
diff http/src/luan/modules/http/Http.luan @ 580:1e69d9c21461
add Table.clear();
add Http.response.reset();
fix http/run;
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 21 Jul 2015 14:56:41 -0600 |
parents | f1601a4ce1aa |
children | 1368ca798ccc |
line wrap: on
line diff
--- a/http/src/luan/modules/http/Http.luan Thu Jul 16 15:14:31 2015 -0600 +++ b/http/src/luan/modules/http/Http.luan Tue Jul 21 14:56:41 2015 -0600 @@ -7,6 +7,8 @@ local Io = require "luan:Io" local Html = require "luan:Html" local url_encode = Html.url_encode or error() +local Table = require "luan:Table" +local clear = Table.clear or error() local HttpServicer = require "java:luan.modules.http.HttpServicer" local IoLuan = require "java:luan.modules.IoLuan" @@ -35,8 +37,12 @@ error "headers are not accessible after you start writing content" end -M.sent_error_metatable = { __index=sent_error, __new_index=sent_error } +local sent_error_metatable = { __index=sent_error, __new_index=sent_error } +function M.sent_headers(headers) + clear(headers) + set_metatable(headers,sent_error_metatable) +end local function new_common(this) @@ -111,7 +117,7 @@ function this.set() HttpServicer.setResponse(this,this.java) - set_metatable(this.headers,M.sent_error_metatable) + M.sent_headers(this.headers) end function this.text_writer() @@ -123,6 +129,11 @@ this.set() return IoLuan.binaryWriter(this.java.getOutputStream()) end + + function this.reset() + this.java.reset() + set_metatable(this.headers,nil) + end end return this end