Mercurial Hosting > luan
comparison src/luan/modules/http/tools/run.luan @ 1150:0842b9b570f8
change http headers interface
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 04 Feb 2018 18:03:37 -0700 |
parents | ea7112e9eb1d |
children | 21d157b153fe |
comparison
equal
deleted
inserted
replaced
1149:1b7c20e20ca7 | 1150:0842b9b570f8 |
---|---|
74 <% end | 74 <% end |
75 | 75 |
76 return function() | 76 return function() |
77 local content_type = Http.request.parameter.content_type | 77 local content_type = Http.request.parameter.content_type |
78 if content_type ~= nil then | 78 if content_type ~= nil then |
79 Http.response.header.content_type = content_type | 79 Http.response.headers["content-type"] = content_type |
80 end | 80 end |
81 Io.stdout = Http.response.text_writer() | 81 Io.stdout = Http.response.text_writer() |
82 local code = Http.request.parameter.code | 82 local code = Http.request.parameter.code |
83 if code == nil then | 83 if code == nil then |
84 form() | 84 form() |
89 local run = load(code,"<web_run>") | 89 local run = load(code,"<web_run>") |
90 run() | 90 run() |
91 end; | 91 end; |
92 catch = function(e) | 92 catch = function(e) |
93 Http.response.reset() | 93 Http.response.reset() |
94 Http.response.header.content_type = "text/plain" | 94 Http.response.headers["content-type"] = "text/plain" |
95 Io.stdout = Http.response.text_writer() | 95 Io.stdout = Http.response.text_writer() |
96 print(e) | 96 print(e) |
97 print"" | 97 print"" |
98 print"" | 98 print"" |
99 print_with_line_numbers(code) | 99 print_with_line_numbers(code) |