Skip to content

nodef/lurlparser.cxx

 
 

Repository files navigation

Lightweight URL & URI parser (RFC 1738, RFC 3986)

(C) Sergey Kosarevsky, 2015-2020

@corporateshark [email protected]

http://www.linderdaum.com

http://blog.linderdaum.com

=============================

A tiny and lightweight URL & URI parser (RFC 1738, RFC 3986) written in C++.

=============================

Installation

Run:

$ npm i lurlparser.cxx

And then include LUrlParser.h as follows:

#include "node_modules/lurlparser.cxx/LUrlParser.h"

You may also want to include LUrlParser.cpp as follows:

#ifndef __LURLPARSER_CXX__
#define __LURLPARSER_CXX__
#include "node_modules/lurlparser.cxx/LUrlParser.cpp"
#endif

This will include both the function declaration and their definitions into a single file.

=============================

Usage example:

const auto URL = LUrlParser::ParseURL::parseURL( "https://John:[email protected]: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;
}

=============================



ORG

About

Lightweight URL & URI parser (RFC 1738, RFC 3986); Sergey Kosarevsky (2015).

Resources

License

Stars

Watchers

Forks

Languages

  • C++ 95.7%
  • Makefile 2.4%
  • CMake 1.9%