HttpQueryArgs

Possibility to parse the http query arguments of an URL.

File information

Filecommon/ilib/http_query_args.h

Classes HttpQueryArgs
HttpQueryArg

Examples Use of HttpQueryArgs

HttpQueryArgs

HttpQueryArgs

class HttpQueryArgs {
public:
    HttpQueryArgs(char * query);
    class HttpQueryArg * Current();
    class HttpQueryArg * Next();
};

Public functions

HttpQueryArgs (constructor)

Parameters

char * query A char pointer to the query string, which will be modified!
The internal parser tries to find the first occurence of '?' which indicates the start of the HTTP query arguments.
Current (public function)

Return value

class HttpQueryArg * The current http query argument.

Return value

class HttpQueryArg * The next http query argument.

HttpQueryArg

HttpQueryArg

class HttpQueryArg {
public:
    char * name;
    char * value;
};

Public variables

A char pointer to the name of the http query argument.
A char pointer to the value of the http query argument.

Example

The example is based on a WebserverPluginHttpListenResult, where you receive a char pointer resourceName which contains the query arguments.

for (class HttpQueryArgs args(resourceName); args.Current(); args.Next()) {
    class HttpQueryArg * arg = args.Current();
    if (!strcasecmp(arg->name, "msg")) {
        debug->printf("The argument msg has the value %s", arg->value);
    }
}