Skip to content

aldor007/ngx_url_parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b69adaf · Jul 12, 2018

History

54 Commits
Dec 22, 2015
Apr 2, 2017
Nov 30, 2015
Jul 4, 2018
Jul 4, 2018
Jan 5, 2016
Jul 12, 2018
Jan 5, 2016
Jan 5, 2016
Jul 4, 2018
Jan 5, 2016
Apr 2, 2017
Jan 6, 2016

Repository files navigation

Build Status Coverage Status

ngx_url_parser

Yet another url parser, written in C.

This repository contains url parser extracted from source code of NGINX. There are some changes in code it but concept is same as in NGINX.

Usage:

Include ngx_url_parser.h and then

const char * str = "https://user:[email protected]:555/path/?query#fragment";
// struct in which result will be stored
ngx_http_url url;

// run parser
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);