summaryrefslogtreecommitdiff
path: root/tests/cookieJsec.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-23 16:13:02 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-23 16:13:02 -0400
commitdf4a000b4c97378ccadbd1f94d9f930f87228b28 (patch)
tree2034375ed7452282a9f1bbb4b3ee02f5bca63280 /tests/cookieJsec.ur
parent1c5416512d92309bb3f6a98f439edaf5a21d2318 (diff)
Cookie signatures for RPCs
Diffstat (limited to 'tests/cookieJsec.ur')
-rw-r--r--tests/cookieJsec.ur27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/cookieJsec.ur b/tests/cookieJsec.ur
new file mode 100644
index 00000000..46668cf8
--- /dev/null
+++ b/tests/cookieJsec.ur
@@ -0,0 +1,27 @@
+table t : {Id : int}
+
+cookie c : int
+
+fun setter r =
+ setCookie c (readError r.Id);
+ return <xml>Done</xml>
+
+fun writer () =
+ ido <- getCookie c;
+ case ido of
+ None => error <xml>No cookie</xml>
+ | Some id => dml (INSERT INTO t (Id) VALUES ({[id]}))
+
+fun preWriter () = return <xml><body onload={onConnectFail (alert "RPC error")}>
+ <button onclick={writer ()} value="Write to database"/>
+
+ <a link={main ()}>Back</a>
+</body></xml>
+
+and main () = return <xml><body>
+ <form>
+ <textbox{#Id}/> <submit value="Get cookie" action={setter}/>
+ </form>
+
+ <form><submit action={preWriter} value="Prepare to write to database"/></form>
+</body></xml>