Mercurial > repos > rhope
diff framework.rhope @ 165:47ab97730865
Fix a couple of issues in networking lib
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 10 Mar 2011 04:15:37 +0000 |
parents | f582fd6c75ee |
children |
line wrap: on
line diff
--- a/framework.rhope Fri Jan 07 03:19:26 2011 -0500 +++ b/framework.rhope Thu Mar 10 04:15:37 2011 +0000 @@ -27,7 +27,12 @@ Framework Handler[con,path,request type,queryvars,headers,handler,title,use session] { page <- Page[title, path, use session, queryvars, headers] - handler page <- [handler]Call[page,path] + hstart <- time[0i64] + { handler page <- [handler]Call[page,path] + { + hend <- time[0i64] + Print[["Handler took: "]Append[String[[hend]-[hstart]]]] + }} If[[request type] = ["POST"]] { final page,ncon <- Process POST[handler page, con, headers] @@ -35,7 +40,13 @@ final page <- Val[handler page] ncon <- Val[con] } - string,out headers <- [final page]Render + Val[final page] + { rstart <- time[0i64] + { string,out headers <- [final page]Render + { + rend <- time[0i64] + Print[["Render took: "]Append[String[[rend]-[rstart]]]] + }}} [[string]Write to File[HTTP OK[ncon, Get Content Type[".html"], [string]Byte Length, out headers]]]Close } @@ -458,17 +469,16 @@ Escape HTML Text[string:out] { - out <- [[[string]Replace["&","&"]]Replace["<", "<"]]Replace[">", ">"] + out <- [string]Replace[("&","<",">"),("&","<",">")] } Render@Web Text[text:out,headers] { - escaped <- Escape HTML Text[[text]Text >>] If[[text]Preformatted >>] { - processed text <- Val[escaped] + processed text <- Escape HTML Text[[text]Text >>] }{ - processed text <- [escaped]Replace["\n","<br>\n\t"] + processed text <- [[text]Text >>]Replace[("&","<",">","\n"),("&","<",">","<br>\n\t")] } If[[[[text]Enclosing Tag >>]Length] = [0]] {