Mercurial > urweb
diff src/c/urweb.c @ 1042:a8a825861397
Explicitly abort in-flight RPCs onunload
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 24 Nov 2009 09:24:25 -0500 |
parents | dcc6093e9575 |
children | 93315ac00394 b06a2a65e670 |
line wrap: on
line diff
--- a/src/c/urweb.c Sun Nov 22 17:57:15 2009 -0500 +++ b/src/c/urweb.c Tue Nov 24 09:24:25 2009 -0500 @@ -1173,6 +1173,16 @@ } } +uw_Basis_string uw_Basis_maybe_onunload(uw_context ctx, uw_Basis_string s) { + if (ctx->script_header[0] == 0) + return ""; + else { + char *r = uw_malloc(ctx, 22 + strlen(s)); + sprintf(r, " onunload='unload();%s'", s); + return r; + } +} + extern uw_Basis_string uw_cookie_sig(uw_context); const char *uw_Basis_get_settings(uw_context ctx, uw_unit u) {