# HG changeset patch # User Adam Chlipala # Date 1294343152 18000 # Node ID 64724ef86149c1d1972adc07ca359802a548e029 # Parent 449a12b82db71f00a15b7c6f874347d35618782b Basis.currentUrlHasPost diff -r 449a12b82db7 -r 64724ef86149 include/urweb.h --- a/include/urweb.h Thu Jan 06 14:25:42 2011 -0500 +++ b/include/urweb.h Thu Jan 06 14:45:52 2011 -0500 @@ -322,4 +322,7 @@ uw_Basis_time *uw_Basis_readUtc(uw_context, uw_Basis_string); +void uw_isPost(uw_context); +uw_Basis_bool uw_Basis_currentUrlHasPost(uw_context); + #endif diff -r 449a12b82db7 -r 64724ef86149 lib/ur/basis.urs --- a/lib/ur/basis.urs Thu Jan 06 14:25:42 2011 -0500 +++ b/lib/ur/basis.urs Thu Jan 06 14:45:52 2011 -0500 @@ -634,6 +634,7 @@ val bless : string -> url val checkUrl : string -> option url val currentUrl : transaction url +val currentUrlHasPost : transaction bool val url : transaction page -> url val effectfulUrl : (option queryString -> transaction page) -> url val redirect : t ::: Type -> url -> transaction t diff -r 449a12b82db7 -r 64724ef86149 src/c/request.c --- a/src/c/request.c Thu Jan 06 14:25:42 2011 -0500 +++ b/src/c/request.c Thu Jan 06 14:45:52 2011 -0500 @@ -230,6 +230,7 @@ } is_post = 1; + uw_isPost(ctx); clen_s = uw_Basis_requestHeader(ctx, "Content-type"); if (clen_s && !strncasecmp(clen_s, "multipart/form-data", 19)) { diff -r 449a12b82db7 -r 64724ef86149 src/c/urweb.c --- a/src/c/urweb.c Thu Jan 06 14:25:42 2011 -0500 +++ b/src/c/urweb.c Thu Jan 06 14:45:52 2011 -0500 @@ -442,7 +442,7 @@ void *logger_data; uw_logger log_debug; - int hasPostBody; + int isPost, hasPostBody; uw_Basis_postBody postBody; uw_Basis_string queryString; @@ -508,7 +508,7 @@ ctx->logger_data = logger_data; ctx->log_debug = log_debug; - ctx->hasPostBody = 0; + ctx->isPost = ctx->hasPostBody = 0; ctx->queryString = NULL; @@ -588,7 +588,7 @@ ctx->cur_container = NULL; ctx->used_transactionals = 0; ctx->script_header = ""; - ctx->hasPostBody = 0; + ctx->isPost = ctx->hasPostBody = 0; ctx->queryString = NULL; } @@ -3603,6 +3603,14 @@ return ctx->hasPostBody; } +void uw_isPost(uw_context ctx) { + ctx->isPost = 1; +} + +uw_Basis_bool uw_Basis_currentUrlHasPost(uw_context ctx) { + return ctx->isPost; +} + void uw_setQueryString(uw_context ctx, uw_Basis_string s) { ctx->queryString = s; }