Query String

A Query String is a set of Key-Value pairs or single values added at the end of the request's URL after a question mark character "?". Each fields of the Query are separated by the "&" character.

For more details, see section Query String.

µC/HTTP-server can supports the reception of a Query String in the HTTP request.

Configuration

Compile-time Configuration

The configuration macro HTTPs_CFG_QUERY_STR_EN must be set to DEF_ENABLED in the http-s_cfg.h file to enable this feature.

See section Query String Configuration for more details.

Run-time Configuration

The run-time configuration for Query String is defined as a HTTPs_QUERY_STR_CFG structure. Your application must declare an HTTPs_QUERY_STR_CFG object and include a pointer to this object in the HTTP server instance configuration HTTPs_CFG object where the QueryStrCfgPtr parameter is defined.

See section Query String Configuration for additional details.

Hook Function

The HTTP Server Instance configuration structure (HTTPs_CFG) contains a pointer to an HTTPs_HOOK_CFG object. This object indexes all the hook functions required by your application.

For additional details on the configuration of hook functions, see section Hook Configuration.

To visualize when each hook function is called by the HTTP server core, see section Hook Functions.

To retrieve the Query String data saved by the HTTP server, two hook functions can be used: OnReqHook and OnReqRdySignalHook.

Usage

When the feature is enabled, query string received in an HTTP request are saved by the HTTP server core under a list of key-value pair. This list is available under the parameter QueryStrListPtr inside the HTTPs_CONN structure. This list can be accessible by the upper application inside the hook function OnReqHook and OnReqRdySignalHook.

Single value fields inside the Query String are also supported. The value will still be saved in a Key-Value pair block, but only the value field will be meaningful.