24 lines
505 B
C++
24 lines
505 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace ts6bot::url
|
|
{
|
|
|
|
// Percent-encode a string for use as a query parameter value.
|
|
std::string EncodeComponent(const std::string& s);
|
|
|
|
struct HttpUrl {
|
|
std::string host;
|
|
uint16_t port{};
|
|
std::string path; // begins with '/'
|
|
};
|
|
|
|
// Minimal parser for redirect URIs.
|
|
// Supports: http://<host>:<port>/<path>
|
|
// Throws std::runtime_error on invalid input.
|
|
HttpUrl ParseHttpUrl(const std::string& httpUrl);
|
|
|
|
} // namespace ts6bot::url
|