| 87 | } |
| 88 | |
| 89 | void parse_url( |
| 90 | std::string word, |
| 91 | key_value_map& queries |
| 92 | ) |
| 93 | /*! |
| 94 | Parses the query string of a URL. word should be the stuff that comes |
| 95 | after the ? in the query URL. |
| 96 | !*/ |
| 97 | { |
| 98 | std::string::size_type pos; |
| 99 | |
| 100 | for (pos = 0; pos < word.size(); ++pos) |
| 101 | { |
| 102 | if (word[pos] == '&') |
| 103 | word[pos] = ' '; |
| 104 | } |
| 105 | |
| 106 | std::istringstream sin(word); |
| 107 | sin >> word; |
| 108 | while (sin) |
| 109 | { |
| 110 | pos = word.find_first_of("="); |
| 111 | if (pos != std::string::npos) |
| 112 | { |
| 113 | std::string key = urldecode(word.substr(0,pos)); |
| 114 | std::string value = urldecode(word.substr(pos+1)); |
| 115 | |
| 116 | queries[key] = value; |
| 117 | } |
| 118 | sin >> word; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | void read_with_limit( |
| 123 | std::istream& in, |
no test coverage detected