MCPcopy Create free account
hub / github.com/apache/trafficserver / unescapifyStr

Function unescapifyStr

src/tscore/MatcherUtils.cc:135–163  ·  view source on GitHub ↗

int unescapifyStr(char* buffer) Unescapifies a URL without a making a copy. The passed in string is modified

Source from the content-addressed store, hash-verified

133// The passed in string is modified
134//
135int
136unescapifyStr(char *buffer)
137{
138 char *read = buffer;
139 char *write = buffer;
140 char subStr[3];
141
142 subStr[2] = '\0';
143 while (*read != '\0') {
144 if (*read == '%' && *(read + 1) != '\0' && *(read + 2) != '\0') {
145 subStr[0] = *(++read);
146 subStr[1] = *(++read);
147 *write = static_cast<char>(strtol(subStr, (char **)nullptr, 16));
148 read++;
149 write++;
150 } else if (*read == '+') {
151 *write = ' ';
152 write++;
153 read++;
154 } else {
155 *write = *read;
156 write++;
157 read++;
158 }
159 }
160 *write = '\0';
161
162 return (write - buffer);
163}
164
165const char *
166ExtractIpRange(char *match_str, in_addr_t *min, in_addr_t *max)

Callers 2

parse_argumentsMethod · 0.50
get_stringMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected