---
name: "Eliom_request_info.server"
section: "3o"
platform: "linux"
package: "libeliom-ocaml-doc"
version: "4.0.0-2"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/Eliom_request_info.server"
---

# Eliom\_request\_info.server(3o)

This module contains the functions you need to get (or set) information about current request.

## NAME

Eliom\_request\_info - This module contains the functions you need to get (or set) information about current request.

## Module

Module   Eliom\_request\_info

## Documentation

Module **Eliom\_request\_info**\
  :  **sig end**

This module contains the functions you need to get (or set) information about current request.

**===** **Getting information about the request** **===**

*val get\_http\_method* :  **unit -\> Ocsigen\_http\_frame.Http\_header.http\_method**

returns the HTTP method used for the request (usually GET or POST).

*val get\_user\_agent* :  **unit -\> string**

returns the name of the user agent that did the request (usually the name of the browser).

*val get\_full\_url* :  **unit -\> string**

returns the full URL as a string

*val get\_remote\_ip* :  **unit -\> string**

returns the internet address of the client as a string

*val get\_remote\_inet\_addr* :  **unit -\> Unix.inet\_addr**

returns the internet address of the client, using the type  **Unix.inet\_addr** (defined in OCaml's standard library).

*val get\_current\_full\_path\_string* :  **unit -\> string**

returns the full path of the URL as a string.

*val get\_current\_full\_path* :  **unit -\> Eliom\_lib.Url.path**

returns the full path of the URL using the type  **Url.path**

*val get\_original\_full\_path\_string* :  **unit -\> string**

returns the full path of the URL as first sent by the browser (not changed by previous extensions like rewritemod)

*val get\_original\_full\_path* :  **unit -\> Eliom\_lib.Url.path**

returns the full path of the URL as first sent by the browser (not changed by previous extensions like rewritemod)

*val get\_current\_sub\_path\_string* :  **unit -\> string**

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).

*val get\_current\_sub\_path* :  **unit -\> Eliom\_lib.Url.path**

returns the sub path of the URL using the type  **Url.path** . The sub-path is the full path without the path of the site (set in the configuration file).

*val get\_header\_hostname* :  **unit -\> string option**

returns the hostname that has been sent by the user agent. For HTTP/1.0, the Host field is not mandatory in the request.

*val get\_hostname* :  **unit -\> string**

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).

*val get\_server\_port* :  **unit -\> int**

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).

*val get\_ssl* :  **unit -\> bool**

returns true if https is used, false if http.

*val get\_accept\_language* :  **unit -\> (string \* float option) list**

returns the (string \* float option) list corresponding to accept\_language HTTP header of the request.

*val get\_suffix* :  **unit -\> Eliom\_lib.Url.path option**

returns the suffix of the current URL

*val get\_cookies* :  **?cookie\_level:Eliom\_common.cookie\_level -\>** **unit -\> string Ocsigen\_cookies.CookiesTable.t**

returns the cookies sent by the browser

*val get\_timeofday* :  **unit -\> float**

returns an Unix timestamp associated to the request

*val get\_request\_id* :  **unit -\> int64**

returns an unique id associated to the request

**===** **Exceptions and fallbacks** **===**

*val get\_request\_cache* :  **unit -\> Polytables.t**

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.

*val clean\_request\_cache* :  **unit -\> unit**

Remove all data from the request cache

*val get\_link\_too\_old* :  **unit -\> bool**

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.

*val get\_previous\_extension\_error\_code* :  **unit -\> int**

returns the HTTP error code sent by the Ocsigen extension that tried to answer to the request before Eliom. It is 404 by default.

**===** **Getting information about files uploaded** **===**

**=== Warning: The files uploaded are automatically erased by Ocsigen** **just after the request has been fulfilled.** **If you want to keep them, create a new hard link yourself during** **the service (or make a copy). ===**

*val get\_tmp\_filename* :  **Ocsigen\_extensions.file\_info -\> string**

returns the filename used by Ocsigen for the uploaded file.

*val get\_filesize* :  **Ocsigen\_extensions.file\_info -\> int64**

returns the size of the file.

*val get\_original\_filename* :  **Ocsigen\_extensions.file\_info -\> string**

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).

*val get\_site\_dir* :  **unit -\> Eliom\_lib.Url.path**

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. ===**

*val get\_get\_params* :  **unit -\> (string \* string) list**

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).

*val get\_all\_current\_get\_params* :  **unit -\> (string \* string) list**

returns current parameters of the URL (GET parameters) (even those that are for subsequent services, but not previous actions)

*val get\_initial\_get\_params* :  **unit -\> (string \* string) list**

returns all parameters of the URL (GET parameters) as sent initially by the browser

*val get\_other\_get\_params* :  **unit -\> (string \* string) list**

returns the parameters of the URL (GET parameters) that do not concern the running service.

*val get\_nl\_get\_params* :  **unit -\> (string \* string) list Eliom\_lib.String.Table.t**

returns non localized parameters in the URL.

*val get\_persistent\_nl\_get\_params* :  **unit -\> (string \* string) list Eliom\_lib.String.Table.t**

returns persistent non localized parameters in the URL.

*val get\_nl\_post\_params* :  **unit -\> (string \* string) list Eliom\_lib.String.Table.t**

returns non localized POST parameters.

*val get\_post\_params* :  **unit -\> (string \* string) list Lwt.t option**

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.

*val get\_all\_post\_params* :  **unit -\> (string \* string) list option**

returns all parameters in the body of the HTTP request (POST parameters) (even those that are for another service)

**===** **Other low level functions** **===**

**=== You probably don't need these functions. ===**

*val get\_ri* :  **unit -\> Ocsigen\_extensions.request\_info**

returns all the information about the request.

*val get\_request* :  **unit -\> Ocsigen\_extensions.request**

returns all the information about the request and config.

*val get\_state\_name* :  **unit -\> Eliom\_common.full\_state\_name option**

returns the name of the sessions to which belongs the running service ( **None** if it is not a session service)

*val get\_persistent\_cookies* :  **unit -\> string Eliom\_common.Full\_state\_name\_table.t**

returns the values of the Eliom's cookies for persistent sessions sent by the browser.

*val get\_data\_cookies* :  **unit -\> string Eliom\_common.Full\_state\_name\_table.t**

returns the values of Eliom's cookies for non persistent sessions sent by the browser.

*val get\_previous\_extension\_error\_code* :  **unit -\> int**

Returns the http error code of the request before Eliom was called

*val expecting\_process\_page* :  **unit -\> bool**

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. ===**

*val get\_csp\_original\_full\_path* :  **unit -\> Eliom\_lib.Url.path**

returns the full path of the URL where the client-side process is running. If there is no client side process, same as **Eliom\_request\_info.get\_original\_full\_path** .

*val get\_csp\_hostname* :  **unit -\> string**

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  **Eliom\_request\_info.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).

*val get\_csp\_server\_port* :  **unit -\> int**

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 **Eliom\_request\_info.get\_server\_port** .

*val get\_csp\_ssl* :  **unit -\> bool**

returns true if https is used in the URL of the browser, false if http. If there is no client side process, same as  **Eliom\_request\_info.get\_ssl** .

*val get\_sitedata* :  **unit -\> Eliom\_common.sitedata**
