From: Glyn M. <gly...@gm...> - 2009-11-10 12:49:31
|
Hello Jeroen, 2009/11/10 Jeroen Habraken <vex...@gm...> > Hi, > > I've been looking at cpp-netlib and it's great to finally see a > library focussing on the network side, and HTTP in specific. I was > wondering though if any of the current URI parsing implementations can > be used to parse the query-string of a URI into a map ? > > Yeah this should certainly be possible but at the moment we're still working on the implementation so as yet, no working URI code. If you're interested and you have any suggestions you can contribute to the discussions on the wiki: http://sourceforge.net/apps/trac/cpp-netlib/wiki/URIAPIRequirements I don't know yet, but I imagine something similar to: namespace bn = boost::network; bn::http::uri instance("http://example.com/?foo=bar&x=y") std::string scheme, host, path; std::map<std::string, std::string> query_params; instance >> bn::scheme(scheme) >> bn::host(host) >> bn::path(path) >> bn::query(query_params); assert(scheme == "http"); assert(host == "example.com"); assert(path == "/"); assert(query_params["foo"] == "bar"); assert(query_params["x"] == "y"); Regards, Glyn |