summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/js/urweb.js14
-rw-r--r--src/c/urweb.c4
-rw-r--r--src/cjr_print.sml12
3 files changed, 18 insertions, 12 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 9f3c332f..71a1a53d 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -487,7 +487,7 @@ function eh(x) {
function ts(x) { return x.toString() }
function bs(b) { return (b ? "True" : "False") }
-function sub(s, i) { return s[i]; }
+function sub(s, i) { return s.charAt(i); }
function suf(s, i) { return s.substring(i); }
function slen(s) { return s.length; }
function sidx(s, ch) {
@@ -499,7 +499,7 @@ function sidx(s, ch) {
}
function sspn(s, chs) {
for (var i = 0; i < s.length; ++i)
- if (chs.indexOf(s[i]) != -1)
+ if (chs.indexOf(s.charAt(i)) != -1)
return i;
return null;
@@ -550,14 +550,14 @@ function pflo(s) {
function uf(s) {
if (s.length == 0)
return "_";
- return (s[0] == '_' ? "_" : "")
+ return (s.charAt(0) == '_' ? "_" : "")
+ escape(s).replace(new RegExp ("/", "g"), "%2F").replace(new RegExp ("\\+", "g"), "%2B");
}
function uu(s) {
- if (s.length > 0 && s[0] == '_')
+ if (s.length > 0 && s.charAt(0) == '_') {
s = s.substring(1);
- else if (s.length >= 3 && s[0] == '%' && s[1] == '5' && (s[2] == 'f' || s[2] == 'F'))
+ } else if (s.length >= 3 && s.charAt(0) == '%' && s.charAt(1) == '5' && (s.charAt(2) == 'f' || s.charAt(2) == 'F'))
s = s.substring(3);
return unescape(s.replace(new RegExp ("\\+", "g"), " "));
}
@@ -657,7 +657,7 @@ function rc(prefix, uri, parse, k, needsSig) {
}
function path_join(s1, s2) {
- if (s1.length > 0 && s1[s1.length-1] == '/')
+ if (s1.length > 0 && s1.charAt(s1.length-1) == '/')
return s1 + s2;
else
return s1 + "/" + s2;
@@ -754,6 +754,8 @@ function listener() {
}
}
+ xhr.abort();
+
connect();
}
else {
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 72f78a33..e75d0c66 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -672,6 +672,8 @@ static input *check_input_space(uw_context ctx, size_t len) {
}
int uw_set_input(uw_context ctx, const char *name, char *value) {
+ printf("Input name %s\n", name);
+
if (!strcasecmp(name, ".b")) {
int n = uw_input_num(value);
input *inps;
@@ -760,6 +762,8 @@ int uw_set_input(uw_context ctx, const char *name, char *value) {
int n = uw_input_num(name);
if (n < 0) {
+ if (!strcmp(name, "null"))
+ return 0;
uw_set_error(ctx, "Bad input name %s", name);
return -1;
}
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 164035eb..e459db62 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -2575,16 +2575,16 @@ fun p_file env (ds, ps) =
end,
string "\");",
newline,
- string "uw_set_needs_push(ctx, ",
- string (case side of
- ServerAndPullAndPush => "1"
- | _ => "0"),
- string ");",
- newline,
string "uw_set_url_prefix(ctx, \"",
string (Settings.getUrlPrefix ()),
string "\");",
newline]),
+ string "uw_set_needs_push(ctx, ",
+ string (case side of
+ ServerAndPullAndPush => "1"
+ | _ => "0"),
+ string ");",
+ newline,
string "uw_set_needs_sig(ctx, ",
string (if couldWrite ek then
"1"