MCPcopy Create free account
hub / github.com/apache/httpd / ap_proxy_c2hex

Function ap_proxy_c2hex

modules/proxy/proxy_util.c:173–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173PROXY_DECLARE(void) ap_proxy_c2hex(int ch, char *x)
174{
175#if !APR_CHARSET_EBCDIC
176 int i;
177
178 x[0] = '%';
179 i = (ch & 0xF0) >> 4;
180 if (i >= 10) {
181 x[1] = ('A' - 10) + i;
182 }
183 else {
184 x[1] = '0' + i;
185 }
186
187 i = ch & 0x0F;
188 if (i >= 10) {
189 x[2] = ('A' - 10) + i;
190 }
191 else {
192 x[2] = '0' + i;
193 }
194#else /*APR_CHARSET_EBCDIC*/
195 static const char ntoa[] = { "0123456789ABCDEF" };
196 char buf[1];
197
198 ch &= 0xFF;
199
200 buf[0] = ch;
201 ap_xlate_proto_to_ascii(buf, 1);
202
203 x[0] = '%';
204 x[1] = ntoa[(buf[0] >> 4) & 0x0F];
205 x[2] = ntoa[buf[0] & 0x0F];
206 x[3] = '\0';
207#endif /*APR_CHARSET_EBCDIC*/
208}
209
210/*
211 * canonicalise a URL-encoded string

Callers 1

ap_proxy_canonenc_exFunction · 0.85

Calls 1

ap_xlate_proto_to_asciiFunction · 0.85

Tested by

no test coverage detected