# # # patch "uri.cc" # from [511f1e52d66a9ae4a10b43db25766d9c0a83970f] # to [7bceca35d0392056ffac79ff547f4437df0a9888] # # patch "uri.hh" # from [e2090172c24e25c3596cdb492e2666dd5e3e68aa] # to [45fa0ade834d91e8f7dac93b526ce786d19fb762] # ============================================================ --- uri.cc 511f1e52d66a9ae4a10b43db25766d9c0a83970f +++ uri.cc 7bceca35d0392056ffac79ff547f4437df0a9888 @@ -10,10 +10,21 @@ #include "base.hh" #include "sanity.hh" #include "uri.hh" +#include "lexical_cast.hh" using std::string; +using boost::lexical_cast; typedef string::size_type stringpos; +size_t +uri::parse_port(size_t const default_port) const +{ + if (port.empty()) + return default_port; + else + return lexical_cast(port); +} + static void parse_authority(string const & in, uri & u) { ============================================================ --- uri.hh e2090172c24e25c3596cdb492e2666dd5e3e68aa +++ uri.hh 45fa0ade834d91e8f7dac93b526ce786d19fb762 @@ -20,6 +20,10 @@ struct uri std::string path; std::string query; std::string fragment; + + // returns the port number, if given - a falback + // port otherwise + size_t parse_port(size_t const default_port) const; }; void