MCPcopy Index your code
hub / github.com/apache/httpd / regen_key

Function regen_key

modules/cache/mod_cache_disk.c:260–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260static const char* regen_key(apr_pool_t *p, apr_table_t *headers,
261 apr_array_header_t *varray, const char *oldkey)
262{
263 struct iovec *iov;
264 int i, k;
265 int nvec;
266 const char *header;
267 const char **elts;
268
269 nvec = (varray->nelts * 2) + 1;
270 iov = apr_palloc(p, sizeof(struct iovec) * nvec);
271 elts = (const char **) varray->elts;
272
273 /* TODO:
274 * - Handle multiple-value headers better. (sort them?)
275 * - Handle Case in-sensitive Values better.
276 * This isn't the end of the world, since it just lowers the cache
277 * hit rate, but it would be nice to fix.
278 *
279 * The majority are case insenstive if they are values (encoding etc).
280 * Most of rfc2616 is case insensitive on header contents.
281 *
282 * So the better solution may be to identify headers which should be
283 * treated case-sensitive?
284 * HTTP URI's (3.2.3) [host and scheme are insensitive]
285 * HTTP method (5.1.1)
286 * HTTP-date values (3.3.1)
287 * 3.7 Media Types [excerpt]
288 * The type, subtype, and parameter attribute names are case-
289 * insensitive. Parameter values might or might not be case-sensitive,
290 * depending on the semantics of the parameter name.
291 * 4.20 Except [excerpt]
292 * Comparison of expectation values is case-insensitive for unquoted
293 * tokens (including the 100-continue token), and is case-sensitive for
294 * quoted-string expectation-extensions.
295 */
296
297 for (i=0, k=0; i < varray->nelts; i++) {
298 header = apr_table_get(headers, elts[i]);
299 if (!header) {
300 header = "";
301 }
302 iov[k].iov_base = (char*) elts[i];
303 iov[k].iov_len = strlen(elts[i]);
304 k++;
305 iov[k].iov_base = (char*) header;
306 iov[k].iov_len = strlen(header);
307 k++;
308 }
309 iov[k].iov_base = (char*) oldkey;
310 iov[k].iov_len = strlen(oldkey);
311 k++;
312
313 return apr_pstrcatv(p, iov, k, NULL);
314}
315
316static int array_alphasort(const void *fn1, const void *fn2)
317{

Callers 2

open_entityFunction · 0.70
write_headersFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected