| 58 | } |
| 59 | |
| 60 | const std::string urldecode ( |
| 61 | const std::string& str |
| 62 | ) |
| 63 | { |
| 64 | using namespace std; |
| 65 | string result; |
| 66 | string::size_type i; |
| 67 | for (i = 0; i < str.size(); ++i) |
| 68 | { |
| 69 | if (str[i] == '+') |
| 70 | { |
| 71 | result += ' '; |
| 72 | } |
| 73 | else if (str[i] == '%' && str.size() > i+2) |
| 74 | { |
| 75 | const unsigned char ch1 = from_hex(str[i+1]); |
| 76 | const unsigned char ch2 = from_hex(str[i+2]); |
| 77 | const unsigned char ch = (ch1 << 4) | ch2; |
| 78 | result += ch; |
| 79 | i += 2; |
| 80 | } |
| 81 | else |
| 82 | { |
| 83 | result += str[i]; |
| 84 | } |
| 85 | } |
| 86 | return result; |
| 87 | } |
| 88 | |
| 89 | void parse_url( |
| 90 | std::string word, |
no test coverage detected