changeset 400:e756d3a47726

Fix a nasty driver bug, involving memory restarts and marked-up request strings
author Adam Chlipala <adamc@hcoop.net>
date Tue, 21 Oct 2008 13:54:48 -0400
parents 2d64457eedb1
children cc71fb7e5e54
files demo/listFun.ur src/c/driver.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/demo/listFun.ur	Tue Oct 21 13:41:03 2008 -0400
+++ b/demo/listFun.ur	Tue Oct 21 13:54:48 2008 -0400
@@ -12,6 +12,7 @@
       
     fun console (ls : list M.t) = return <xml><body>
       Current list: {toXml ls}<br/>
+      Reversed list: {toXml (rev ls)}<br/>
       Length: {[length ls]}<br/>
       <br/>
 
--- a/src/c/driver.c	Tue Oct 21 13:41:03 2008 -0400
+++ b/src/c/driver.c	Tue Oct 21 13:54:48 2008 -0400
@@ -116,7 +116,7 @@
       *back = 0;
     
       if (s = strstr(buf, "\r\n\r\n")) {
-        char *cmd, *path, *inputs;
+        char *cmd, *path, path_copy[uw_bufsize+1], *inputs;
 
         *s = 0;
 
@@ -175,7 +175,8 @@
           uw_write(ctx, "Content-type: text/html\r\n\r\n");
           uw_write(ctx, "<html>");
 
-          fk = uw_begin(ctx, path);
+          strcpy(path_copy, path);
+          fk = uw_begin(ctx, path_copy);
           if (fk == SUCCESS) {
             uw_write(ctx, "</html>");
             break;