diff options
author | Adam Chlipala <adam@chlipala.net> | 2016-03-30 15:39:02 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2016-03-30 15:39:02 -0400 |
commit | 12783217508fd87c962a2d4871c6d3dbbcf58dee (patch) | |
tree | 3cb5a9a7f8b7764e32493d6d13efe886b02e398a | |
parent | 1a9520d6e00c63baca356d7e6aa2acc7424148bb (diff) |
At runtime, catch when we exceed 'limit inputs'
-rw-r--r-- | src/c/request.c | 7 | ||||
-rw-r--r-- | tests/formLimit.ur | 11 | ||||
-rw-r--r-- | tests/formLimit.urp | 4 | ||||
-rw-r--r-- | tests/formLimit.urs | 1 |
4 files changed, 22 insertions, 1 deletions
diff --git a/src/c/request.c b/src/c/request.c index d621aea7..cad84cb2 100644 --- a/src/c/request.c +++ b/src/c/request.c @@ -39,7 +39,12 @@ uw_context uw_request_new_context(int id, uw_app *app, uw_loggers *ls) { uw_logger log_error = ls->log_error; uw_context ctx = uw_init(id, ls); int retries_left = MAX_RETRIES; - uw_set_app(ctx, app); + + if (uw_set_app(ctx, app)) { + log_error(logger_data, "Unable to initialize request context. Most likely the limit on number of form inputs has been exceeded.\n"); + uw_free(ctx); + return NULL; + } while (1) { failure_kind fk = uw_begin_init(ctx); diff --git a/tests/formLimit.ur b/tests/formLimit.ur new file mode 100644 index 00000000..d591f736 --- /dev/null +++ b/tests/formLimit.ur @@ -0,0 +1,11 @@ +fun handler r = return <xml><body> + {[r.A]}, {[r.B]} +</body></xml> + +fun main () = return <xml><body> + <form> + <textbox{#A}/> + <textbox{#B}/> + <submit action={handler}/> + </form> +</body></xml> diff --git a/tests/formLimit.urp b/tests/formLimit.urp new file mode 100644 index 00000000..3fd7e5c3 --- /dev/null +++ b/tests/formLimit.urp @@ -0,0 +1,4 @@ +rewrite all FormLimit/* +limit inputs 1 + +formLimit diff --git a/tests/formLimit.urs b/tests/formLimit.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/formLimit.urs @@ -0,0 +1 @@ +val main : unit -> transaction page |