summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-05-29 14:29:26 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-05-29 14:29:26 -0400
commit5b421885fdfad728ab584ef15ec1873ec3bc2a05 (patch)
tree02dc2d6caca935269cf3c6f523ad087c80d9c778 /doc
parentf92289880fd8457a080e150cb50f0fa2af3eff9c (diff)
getHeader and setHeader
Diffstat (limited to 'doc')
-rw-r--r--doc/manual.tex16
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/manual.tex b/doc/manual.tex
index 07c80b69..755cc735 100644
--- a/doc/manual.tex
+++ b/doc/manual.tex
@@ -136,7 +136,7 @@ For each entry \texttt{M} in the module list, the file \texttt{M.urs} is include
Here is the complete list of directive forms. ``FFI'' stands for ``foreign function interface,'' Ur's facility for interaction between Ur programs and C and JavaScript libraries.
\begin{itemize}
-\item \texttt{[allow|deny] [url|mime] PATTERN} registers a rule governing which URLs or MIME types are allowed in this application. The first such rule to match a URL or MIME type determines the verdict. If \texttt{PATTERN} ends in \texttt{*}, it is interpreted as a prefix rule. Otherwise, a string must match it exactly.
+\item \texttt{[allow|deny] [url|mime|requestHeader|responseHeader] PATTERN} registers a rule governing which URLs, MIME types, HTTP request headers, or HTTP response headers are allowed to appear explicitly in this application. The first such rule to match a name determines the verdict. If \texttt{PATTERN} ends in \texttt{*}, it is interpreted as a prefix rule. Otherwise, a string must match it exactly.
\item \texttt{alwaysInline PATH} requests that every call to the referenced function be inlined. Section \ref{structure} explains how functions are assigned path strings.
\item \texttt{benignEffectful Module.ident} registers an FFI function or transaction as having side effects. The optimizer avoids removing, moving, or duplicating calls to such functions. Every effectful FFI function must be registered, or the optimizer may make invalid transformations. This version of the \texttt{effectful} directive registers that this function only has side effects that remain local to a single page generation.
\item \texttt{clientOnly Module.ident} registers an FFI function or transaction that may only be run in client browsers.
@@ -1406,6 +1406,20 @@ $$\begin{array}{l}
\mt{val} \; \mt{fileData} : \mt{file} \to \mt{blob}
\end{array}$$
+It is also possible to get HTTP request headers and set HTTP response headers, using abstract types similar to the one for URLs.
+
+$$\begin{array}{l}
+ \mt{type} \; \mt{requestHeader} \\
+ \mt{val} \; \mt{blessRequestHeader} : \mt{string} \to \mt{requestHeader} \\
+ \mt{val} \; \mt{checkRequestHeader} : \mt{string} \to \mt{option} \; \mt{requestHeader} \\
+ \mt{val} \; \mt{getHeader} : \mt{requestHeader} \to \mt{transaction} \; (\mt{option} \; \mt{string}) \\
+ \\
+ \mt{type} \; \mt{responseHeader} \\
+ \mt{val} \; \mt{blessResponseHeader} : \mt{string} \to \mt{responseHeader} \\
+ \mt{val} \; \mt{checkResponseHeader} : \mt{string} \to \mt{option} \; \mt{responseHeader} \\
+ \mt{val} \; \mt{setHeader} : \mt{responseHeader} \to \mt{string} \to \mt{transaction} \; \mt{unit}
+\end{array}$$
+
A blob can be extracted from a file and returned as the page result. There are bless and check functions for MIME types analogous to those for URLs.
$$\begin{array}{l}
\mt{type} \; \mt{mimeType} \\