-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.c
32 lines (26 loc) · 811 Bytes
/
example.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
#include "ngx_url_parser.h"
int main(int argc, char *argv[])
{
const char * str = "https://user:password@mkaciuba.pl:555/path/?query#fragment";
// struct in with result will be stored
ngx_http_url url;
int status = ngx_url_parser(&url, str);
if (status != NGX_URL_OK) {
printf("Error processing url!\n");
return 1;
}
printf("Url = %s\n", str);
printf("\nParse status %d", status);
printf("\n scheme = %s", url.scheme);
printf("\n Host = %s", url.host);
printf("\n Port = %s", url.port);
printf("\n Path = %s", url.path);
printf("\n Query = %s", url.query);
printf("\n Fragment = %s", url.fragment);
printf("\n auth = %s", url.auth);
printf("\n");
// free memory
ngx_url_free(&url);
return 0;
}