38#define CATEGORY "/main/uri/"
41 {
"http://name:pass@localhost",
"http",
"name:pass",
"localhost",
NULL,
NULL,
NULL},
43 {
"http://localhost:80",
"http",
NULL,
"localhost",
"80",
NULL,
NULL},
44 {
"http://localhost/path/",
"http",
NULL,
"localhost",
NULL,
"path/",
NULL},
45 {
"http://localhost/?query",
"http",
NULL,
"localhost",
NULL,
"",
"query"},
46 {
"http://localhost:80/path",
"http",
NULL,
"localhost",
"80",
"path",
NULL},
47 {
"http://localhost:80/?query",
"http",
NULL,
"localhost",
"80",
"",
"query"},
48 {
"http://localhost:80/path?query",
"http",
NULL,
"localhost",
"80",
"path",
"query"},
53#define VALIDATE(value, expected_value) \
54 do { ast_test_validate(test, \
55 (value == expected_value) || \
56 (value && expected_value && \
57 !strcmp(value, expected_value))); \
64 info->name = __func__;
66 info->summary =
"Uri parsing scenarios";
67 info->description =
"For each scenario validate result(s)";
94 info->name = __func__;
96 info->summary =
"parse an http uri with host only";
118 info->name = __func__;
120 info->summary =
"parse an https uri with host only";
Asterisk main include file. File version handling, generic pbx functions.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
Stores parsed uri information.
#define AST_TEST_REGISTER(cb)
#define AST_TEST_UNREGISTER(cb)
AST_TEST_DEFINE(uri_parse)
#define VALIDATE(value, expected_value)
static int load_module(void)
static const char * scenarios[][7]
static int unload_module(void)
const char * ast_uri_path(const struct ast_uri *uri)
Retrieve the uri path.
const char * ast_uri_scheme(const struct ast_uri *uri)
Retrieve the uri scheme.
struct ast_uri * ast_uri_parse_http(const char *uri)
Parse the given http uri into a structure.
const char * ast_uri_port(const struct ast_uri *uri)
Retrieve the uri port.
const char * ast_uri_query(const struct ast_uri *uri)
Retrieve the uri query parameters.
const char * ast_uri_user_info(const struct ast_uri *uri)
Retrieve the uri user information.
int attribute_pure ast_uri_is_secure(const struct ast_uri *uri)
Retrieve if the uri is of a secure type.
const char * ast_uri_host(const struct ast_uri *uri)
Retrieve the uri host.
struct ast_uri * ast_uri_parse(const char *uri)
Parse the given uri into a structure.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.