2
function resultFunc = 0;
3
function processFunc = 0;
6
int tid, oid, oclass, cmd;
9
string mimetype = "text/plain";
11
void set_request(object request) {
14
void asyncResult(mixed _id, mixed result) {
15
if ( functionp(processFunc) ) {
17
result = processFunc(result, userData);
19
result = processFunc(result);
21
resultFunc(this_object(), result);
23
int is_async_return() { return 1; }
29
string header = "HTTP/1.1 200 OK\r\nServer: sTeam HTTP\r\nContent-Type: text/html; charset=utf-8\r\nConnection: keep-alive\r\nDate: "+
30
httplib.http_date(time())+"\r\n\r\n";
33
function htmlResultFunc;
37
void create(function f, void|object asReturnObj, void|mapping vars) {
39
if ( objectp(asReturnObj) ) {
40
set_return_object(asReturnObj);
42
asReturnObj->vars = vars;
45
void set_return_object(object asReturnObj) {
46
if ( !objectp(asReturnObj) )
48
asReturn = asReturnObj;
49
asReturn->resultFunc = asyncResult;
52
string set_html(string headHTML, string footHTML) {
57
void output(string str) {
62
void set_request(object request) {
64
if ( stringp(header) ) {
71
void asyncResult(mixed id, mixed result) {
73
if ( functionp(htmlResultFunc) )
74
result = htmlResultFunc(id, result);
76
if ( id == asReturn ) {
77
if (stringp(foot) && strlen(foot) > 0 )