2019-02-15 05:11:42 +01:00
|
|
|
/*
|
|
|
|
* IXUrlParser.h
|
|
|
|
* Author: Benjamin Sergeant
|
|
|
|
* Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2019-03-01 06:18:27 +01:00
|
|
|
#include <regex>
|
2019-02-15 05:11:42 +01:00
|
|
|
|
2019-02-26 00:55:38 +01:00
|
|
|
namespace ix
|
2019-02-15 05:11:42 +01:00
|
|
|
{
|
2019-03-01 06:18:27 +01:00
|
|
|
class UrlParser
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static bool parse(const std::string& url,
|
|
|
|
std::string& protocol,
|
|
|
|
std::string& host,
|
|
|
|
std::string& path,
|
|
|
|
std::string& query,
|
|
|
|
int& port,
|
|
|
|
bool websocket);
|
2019-02-15 05:11:42 +01:00
|
|
|
|
2019-03-01 06:18:27 +01:00
|
|
|
static void printUrl(const std::string& url, bool websocket);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static std::regex _httpRegex;
|
|
|
|
static std::regex _webSocketRegex;
|
|
|
|
};
|
2019-02-15 05:11:42 +01:00
|
|
|
}
|