package eliom
Install
Dune Dependency
Authors
Maintainers
Sources
md5=3aeeca5f734f8e932b5a00fbfd43bd26
sha512=d92948949c81fe5b84f7d262b72653175d4f69574cbb4f85433f3a40df436e9e78b3f024ebcd98cb0e1c8ec45af0e3f9cd1153187549883f4ddfd32feeee3176
doc/eliom.server/Eliom_request_info/index.html
Module Eliom_request_info
Source
This module contains the functions you need to get (or set) information about current request.
Getting information about the request
returns true
when currently handling a request.
returns the HTTP method used for the request (usually GET or POST).
returns the name of the user agent that did the request (usually the name of the browser).
returns the full URL as a string
returns the internet address of the client as a string
returns the full path of the URL as first sent by the browser (not changed by previous extensions like rewritemod)
returns the full path of the URL as first sent by the browser (not changed by previous extensions like rewritemod)
returns the sub path of the URL as a string. The sub-path is the full path without the path of the site (set in the configuration file).
returns the sub path of the URL using the type Eliom_lib.Url.path
. The sub-path is the full path without the path of the site (set in the configuration file).
returns the hostname that has been sent by the user agent. For HTTP/1.0, the Host field is not mandatory in the request.
returns the hostname used for absolute links. It is either the Host
header sent by the browser or the default hostname set in the configuration file, depending on server configuration (<usedefaulthostname/>
option).
returns the port of the server. It is either the default port in the configuration file (if <usedefaulthostname/>
is present is the configuration file), or the port in the Host header of the request (if present), or the port on which the request has been done (otherwise).
returns true if https is used, false if http.
returns the (string * float option) list corresponding to accept_language HTTP header of the request.
returns the suffix of the current URL
val get_cookies :
?cookie_level:Eliom_common.cookie_level ->
unit ->
string Ocsigen_cookie_map.Map_inner.t
returns the cookies sent by the browser
returns an Unix timestamp associated to the request
Exceptions and fallbacks
returns a table in which you can store all the data you want during a request. It can also be used to send information after an action. Keep an eye on this information to know what succeeded before the current service was called (failed connection, timeout ...) The table is created at the beginning of the request.
returns true
if the coservice called has not been found. In that case, the current service is the fallback.
val get_expired_service_sessions :
unit ->
Eliom_common.full_state_name list * Eliom_common.full_state_name list
returns the list of names of service sessions expired for the current request, for browser sessions and tab sessions.
returns the HTTP error code sent by the Ocsigen extension that tried to answer to the request before Eliom. It is 404 by default.
returns the filename used by Ocsigen for the uploaded file.
returns the size of the uploaded file.
returns the name the file had on the client when it has been sent.
val get_file_content_type :
Ocsigen_extensions.file_info ->
((string * string) * (string * string) list) option
returns the content type sent by the browser with the file (if any).
returns the root of the site. Raises Eliom_common.Eliom_site_information_not_available
if unavailable.
returns the root of the site.
Getting parameters (low level)
The usual way to get parameters with Eliom is to use the second and third parameters of the service handlers. These are low level functions you may need for more advanced use.
returns the parameters of the URL (GET parameters) that concern the running service. For example in the case of a non-attached coservice called from a page with GET parameters, only the parameters of that non-attached coservice are returned (even if the other are still in the URL).
returns current parameters of the URL (GET parameters) (even those that are for subsequent services, but not previous actions)
returns the parameters of the URL (GET parameters) that do not concern the running service.
returns non localized parameters in the URL.
returns persistent non localized parameters in the URL.
returns non localized POST parameters.
returns the parameters in the body of the HTTP request (POST parameters) that concern the running service. None means that POST data where neither urlencoded form data or multipart data.
returns all parameters in the body of the HTTP request (POST parameters) (even those that are for another service)
returns all files in he HTTP request (even those that are for another service)
returns the GET parameters that have been ignored using <ignoredgetparams/> in config file.
returns the POST parameters that have been ignored using <ignoredpostparams/> in config file.
Other low level functions
You probably don't need these functions.
returns all the information about the request.
returns all the information about the request and config.
returns the name of the sessions to which belongs the running service (None
if it is not a session service)
returns the values of the Eliom's cookies for persistent sessions sent by the browser.
returns the values of Eliom's cookies for non persistent sessions sent by the browser.
Returns true
if the request was done by a client side Eliom program, which was expecting to receive a new HTML page to display inside the process.
Getting information about the URL of the client side process (csp)
Warning: it is different from the URL to which the request has been made.
returns the full path of the URL where the client-side process is running. If there is no client side process, same as get_original_full_path
.
returns the hostname used for absolute links, computed when launching the client side process for the first time. If there is no client side process, same as get_hostname
.
It is either the Host
header sent by the browser or the default hostname set in the configuration file, depending on server configuration (<usedefaulthostname/>
option).
returns the port of the server, used when launching the client side process (not the current request). It corresponds to the port in the URL of the browser. If there is no client side process, same as get_server_port
.
returns true if https is used in the URL of the browser, false if http. If there is no client side process, same as get_ssl
.