Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
url.hpp File Reference

Minimal URL parser + builder utility. More...

#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::runtime::Url
 Parsed URL components. More...

Namespaces

namespace  pulp
namespace  pulp::runtime

Functions

std::string pulp::runtime::percent_encode (std::string_view s)
 Percent-encode s per RFC 3986 — unreserved characters (A-Z a-z 0-9 - _ .
std::string pulp::runtime::percent_decode (std::string_view s)
 Decode percent-escapes — %20 → space, %2F → /.
std::string pulp::runtime::form_encode (std::string_view s)
 application/x-www-form-urlencoded style — space → +, then percent-encode everything else.
std::string pulp::runtime::form_decode (std::string_view s)
 Reverse of form_encode. + decodes to space.
std::vector< std::pair< std::string, std::string > > pulp::runtime::parse_query (std::string_view query)
 Parse a URL query string into key/value pairs.
std::string pulp::runtime::build_query (const std::vector< std::pair< std::string, std::string > > &params)
 Build a query string from key/value pairs.

Detailed Description

Minimal URL parser + builder utility.

Transport already lives in http_* and http_download; this header adds the structural parse/build that callers need for query-string manipulation, scheme dispatch, and round-tripping a URL through state.

Scope:

  • Parses the common URL grammar — scheme://[user[:pass]@]host [:port][/path][?query][#fragment].
  • Does NOT implement the full WHATWG URL Living Standard (no IDNA punycode, no percent-encoded host validation). Sufficient for audio plugin / app use cases — preset URLs, update feeds, telemetry endpoints, OSC bridges, license check-ins.
  • Percent-encoding is provided as standalone helpers.