MCPcopy Create free account
hub / github.com/davisking/dlib / parse_url

Function parse_url

dlib/server/server_http.cpp:89–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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,

Callers 2

grab_urlMethod · 0.85
parse_http_requestFunction · 0.85

Calls 2

urldecodeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected