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

Function get_entry

modules/mappers/mod_negotiation.c:409–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407 */
408
409static const char *get_entry(apr_pool_t *p, accept_rec *result,
410 const char *accept_line)
411{
412 result->quality = 1.0f;
413 result->level = 0.0f;
414 result->charset = "";
415
416 /*
417 * Note that this handles what I gather is the "old format",
418 *
419 * Accept: text/html text/plain moo/zot
420 *
421 * without any compatibility kludges --- if the token after the
422 * MIME type begins with a semicolon, we know we're looking at parms,
423 * otherwise, we know we aren't. (So why all the pissing and moaning
424 * in the CERN server code? I must be missing something).
425 */
426
427 result->name = ap_get_token(p, &accept_line, 0);
428 ap_str_tolower(result->name); /* You want case insensitive,
429 * you'll *get* case insensitive.
430 */
431
432 /* KLUDGE!!! Default HTML to level 2.0 unless the browser
433 * *explicitly* says something else.
434 */
435
436 if (!strcmp(result->name, "text/html") && (result->level == 0.0)) {
437 result->level = 2.0f;
438 }
439 else if (!strcmp(result->name, INCLUDES_MAGIC_TYPE)) {
440 result->level = 2.0f;
441 }
442 else if (!strcmp(result->name, INCLUDES_MAGIC_TYPE3)) {
443 result->level = 3.0f;
444 }
445
446 while (*accept_line == ';') {
447 /* Parameters ... */
448
449 char *parm;
450 char *cp;
451 char *end;
452
453 ++accept_line;
454 parm = ap_get_token(p, &accept_line, 1);
455
456 /* Look for 'var = value' --- and make sure the var is in lcase. */
457
458 for (cp = parm; (*cp && !apr_isspace(*cp) && *cp != '='); ++cp) {
459 *cp = apr_tolower(*cp);
460 }
461
462 if (!*cp) {
463 continue; /* No '='; just ignore it. */
464 }
465
466 *cp++ = '\0'; /* Delimit var */

Callers 3

do_header_lineFunction · 0.85
read_type_mapFunction · 0.85
mod_negotiation.cFile · 0.85

Calls 3

ap_get_tokenFunction · 0.85
ap_str_tolowerFunction · 0.85
atoqFunction · 0.85

Tested by

no test coverage detected