getQuery :: HttpRequest String -> Maybe (FilePath, [(String, String)]) getSimpleQuery :: HttpRequest String -> Maybe (FilePath, String)
These functions extract the most important information from an HTTP request.
getQuery should be used when the request is from a web page containing
a form in a
<FORM> element. The request method can be either
getSimpleQuery should be used when a query is
submitted from a web page containing an
The result, if the request is well formed, is a pair containing the document path (that was part of the URL) and the submitted data. Special characters that were encoded in the request are decoded (as with decode or decodeQuery).
If a form like
<FORM ACTION="http://myserver:8080/Movie/Search" METHOD=GET> Actor: <INPUT name=actor> <br> Year: <INPUT name=year maxlength=4> <INPUT type=Submit value="Find Movie"> </FORM>
is submitted with some actor and year filled in, the browser constructs an URL like
getQuery to a request containing this URL will yield the
Just ("/Movie/Search",[("year","1999"),("actor","Willis, Bruce")])
The result will be the same if the request method is changed to
(but the form data will be put in another part of the request, and
will thus not be visible in the URL).
Quick reference manual on HTML forms.