From 30edae2956d346e7df7ca27fcc77432e45cea99e Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 19 May 2018 16:06:11 -0400 Subject: More defensive unurlification of enumerations (closes #117) --- src/cjr_print.sml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cjr_print.sml b/src/cjr_print.sml index 1fdb45d9..43265fb8 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -659,7 +659,10 @@ fun unurlify fromClient env (t, loc) = doEm rest, string ")"] in - doEm xncs + box [string "(request[0] == '/' ? ++request : request,", + newline, + doEm xncs, + string ")"] end | TDatatype (Option, i, xncs) => -- cgit v1.2.3 From 3e8fc5122fed2baee3a4d27d51575f6dd5174ea8 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 20 May 2018 19:28:17 -0400 Subject: Proper error message when the body of a 'val' declaration fails to check against the type annotation --- src/elaborate.sml | 3 ++- tests/pairUnify.ur | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/pairUnify.ur (limited to 'src') diff --git a/src/elaborate.sml b/src/elaborate.sml index 4a04d4bf..51d00bd8 100644 --- a/src/elaborate.sml +++ b/src/elaborate.sml @@ -4046,7 +4046,8 @@ and elabDecl (dAll as (d, loc), (env, denv, gs)) = | L.PAnnot (p', _) => singleVar p' | _ => NONE in - unifyCons env loc et pt; + (unifyCons env loc et pt + handle CUnify (c1, c2, env', err) => expError env (Unify (e', c1, c2, env', err))); (case exhaustive (env, et, [p'], loc) of NONE => () diff --git a/tests/pairUnify.ur b/tests/pairUnify.ur new file mode 100644 index 00000000..1c9f9759 --- /dev/null +++ b/tests/pairUnify.ur @@ -0,0 +1,6 @@ +datatype a = A +datatype b = B + +val x : a * b = (A, B) + +val y : b = x -- cgit v1.2.3 From 1c493e9ec47f4754dd7237078e8c4f3300925ce3 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 29 May 2018 09:49:22 -0400 Subject: Remove insecure crypto function (closes #114) --- include/urweb/urweb_cpp.h | 2 -- lib/ur/basis.urs | 5 ----- src/c/urweb.c | 5 ----- 3 files changed, 12 deletions(-) (limited to 'src') diff --git a/include/urweb/urweb_cpp.h b/include/urweb/urweb_cpp.h index 0d5f5e0e..2c60a781 100644 --- a/include/urweb/urweb_cpp.h +++ b/include/urweb/urweb_cpp.h @@ -358,8 +358,6 @@ uw_Basis_string uw_Basis_timef(struct uw_context *, const char *fmt, uw_Basis_ti uw_Basis_time uw_Basis_stringToTimef(struct uw_context *, const char *fmt, uw_Basis_string); uw_Basis_time uw_Basis_stringToTimef_error(struct uw_context *, const char *fmt, uw_Basis_string); -uw_Basis_string uw_Basis_crypt(struct uw_context *, uw_Basis_string key, uw_Basis_string salt); - uw_Basis_bool uw_Basis_eq_time(struct uw_context *, uw_Basis_time, uw_Basis_time); uw_Basis_bool uw_Basis_lt_time(struct uw_context *, uw_Basis_time, uw_Basis_time); uw_Basis_bool uw_Basis_le_time(struct uw_context *, uw_Basis_time, uw_Basis_time); diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index c354d784..dc1b9b76 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -192,11 +192,6 @@ val datetimeSecond : time -> int val datetimeDayOfWeek : time -> int -(** * Encryption *) - -val crypt : string -> string -> string - - (** HTTP operations *) con http_cookie :: Type -> Type diff --git a/src/c/urweb.c b/src/c/urweb.c index 504597ef..283efcdd 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -4490,11 +4490,6 @@ failure_kind uw_runCallback(uw_context ctx, void (*callback)(uw_context)) { return r; } -uw_Basis_string uw_Basis_crypt(uw_context ctx, uw_Basis_string key, uw_Basis_string salt) { - char buf[14]; - return uw_strdup(ctx, DES_fcrypt(key, salt, buf)); -} - uw_Basis_bool uw_Basis_eq_time(uw_context ctx, uw_Basis_time t1, uw_Basis_time t2) { (void)ctx; return !!(t1.seconds == t2.seconds && t1.microseconds == t2.microseconds); -- cgit v1.2.3