Lightweight URL & URI parser (RFC 1738, RFC 3986); Sergey Kosarevsky (2015).
npm install lurlparser.cxxLightweight URL & URI parser (RFC 1738, RFC 3986)
(C) Sergey Kosarevsky, 2015-2020
@corporateshark sk@linderdaum.com
http://www.linderdaum.com
http://blog.linderdaum.com
----
A tiny and lightweight URL & URI parser (RFC 1738, RFC 3986) written in C++.
----
sh
$ npm i lurlparser.cxx
`
And then include lurlparser.h as follows:
`cxx
// main.cxx
#define LURLPARSER_IMPLEMENTATION
#include
int main() { / ... / }
`
Finally, compile while adding the path node_modules/lurlparser.cxx to your compiler's include paths.
`bash
$ clang++ -std=c++17 -I./node_modules/lurlparser.cxx main.cxx # or, use g++
$ g++ -std=c++17 -I./node_modules/lurlparser.cxx main.cxx
`
You may also use a simpler approach with the cpoach tool, which automatically adds the necessary include paths of all the installed dependencies for your project.
`bash
$ cpoach clang++ -std=c++17 main.cxx # or, use g++
$ cpoach g++ -std=c++17 main.cxx
`
----
Usage example
`cxx
const auto URL = LUrlParser::ParseURL::parseURL( "https://John:Dow@github.com:80/corporateshark/LUrlParser" );
if ( URL.isValid() )
{
cout << "Scheme : " << URL.scheme_ << endl;
cout << "Host : " << URL.host_ << endl;
cout << "Port : " << URL.port_ << endl;
cout << "Path : " << URL.path_ << endl;
cout << "Query : " << URL.query_ << endl;
cout << "Fragment : " << URL.fragment_ << endl;
cout << "User name : " << URL.userName_ << endl;
cout << "Password : " << URL.password_ << endl;
}
``