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

Function regen_key

modules/cache/mod_cache_socache.c:279–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

open_entityFunction · 0.70
store_headersFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected