UrlParams.hpp

Get an unordered_map containing url query key/value parameters.

This file is part of Empirical, https://github.com/devosoft/Empirical Copyright (C) 2019 Michigan State University MIT Software license; see doc/LICENSE.md

Defines

INCLUDE_EMP_WEB_URL_PARAMS_HPP_GUARD

Functions

std::multimap<std::string, vector<std::string>> GetUrlParams()

Extracts the query portion of a url and parses for key value pairs.

Some esoterica: “?string=this+that” and “?string=this&string=that” have different meanings and may result in different behavior. Similarly “?test” becomes [[“test”]] while “?test=” becomes [[“test”, “”]].

Note

In a query space encoded by “%20” is interpreted as a space character while the space encoded by “+” is used to separate a list of values for a key. For example querying “?seed=100&strings=hi%20there+blah” will be parsed to the parameter array [[“seed”, “100”], [“strings”, “hi there”, “blah”]] then converted to a multimap.