The Network.Browser goes beyond the basic Network.HTTP functionality in
providing support for more involved, and real, request/response interactions over
HTTP. Additional features supported are:
Use the proxy given. Should be of the
form "http://host:port", "host", "host:port", or "http://host".
Additionally, an optional Authority for authentication with the proxy.
request httpRequest tries to submit the RequesthttpRequest
to some HTTP server (possibly going via a proxy, see setProxy.)
Upon successful delivery, the URL where the response was fetched from
is returned along with the Response itself.
setMaxRedirects maxCount sets the maximum number of forwarding hops
we are willing to jump through. A no-op if the count is negative; if zero,
the max is set to whatever default applies. Notice that setting the max
redirects count does not enable following of redirects itself; use
setAllowRedirects to do so.
getMaxPoolSize gets the maximum size of the connection pool
that is used to cache connections between requests.
If Nothing, the Network.Browser's default is used.
setEventHandler onBrowserEvent configures event handling.
If onBrowserEvent is Nothing, event handling is turned off;
setting it to Just onEv causes the onEv IO action to be
notified of browser events during the processing of a request
by the Browser pipeline.
BrowserEvent is the event record type that a user-defined handler, set
via setEventHandler, will be passed. It indicates various state changes
encountered in the processing of a given RequestID, along with timestamps
at which they occurred.
setProxy p will disable proxy usage if p is NoProxy.
If p is Proxy proxyURL mbAuth, then proxyURL is interpreted
as the URL of the proxy to use, possibly authenticating via
Authority information in mbAuth.
setCheckForProxy flg sets the one-time check for proxy
flag to flg. If True, the session will try to determine
the proxy server is locally configured. See fetchProxy
for details of how this done.
getCheckForProxy returns the current check-proxy setting.
Notice that this may not be equal to True if the session has
set it to that via setCheckForProxy and subsequently performed
some HTTP protocol interactions. i.e., the flag return represents
whether a proxy will be checked for again before any future protocol
interactions.
setDebugLog mbFile turns off debug logging iff mbFile
is Nothing. If set to Just fStem, logs of browser activity
is appended to files of the form fStem-url-authority, i.e.,
fStem is just the prefix for a set of log files, one per host/authority.
setUserAgent ua sets the current User-Agent: string to ua. It
will be used if no explicit user agent header is found in subsequent requests.
A common form of user agent string is "name/version (details)". For
example "cabal-install/0.10.2 (HTTP 4000.1.2)". Including the version
of this HTTP package can be helpful if you ever need to track down HTTP
compatibility quirks. This version is available via httpPackageVersion.
For more info see http://en.wikipedia.org/wiki/User_agent.
uriDefaultTo a b returns a URI that is consistent with the first
argument URI a when read in the context of the second URI b.
If the second argument is not sufficient context for determining
a full URI then anarchy reins.