MCPcopy Create free account
hub / github.com/SIPp/sipp / url_decode

Function url_decode

src/urlcoder.cpp:49–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49std::string url_decode(std::string str) {
50 std::string ret;
51 char ch;
52 size_t len = str.length();
53
54 for (unsigned int i = 0; i < len; i++) {
55 unsigned int ii;
56 if (str[i] != '%') {
57 if (str[i] == '+') {
58 ret += ' ';
59 } else {
60 ret += str[i];
61 }
62 } else {
63 sscanf(str.substr(i + 1, 2).c_str(), "%x", &ii);
64 ch = static_cast<char>(ii);
65 ret += ch;
66 i = i + 2;
67 }
68 }
69 return ret;
70}
71
72#ifdef GTEST
73#include "gtest/gtest.h"

Callers 2

TESTFunction · 0.85
executeActionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected