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

Function parse_accept_headers

modules/mappers/mod_negotiation.c:565–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563 */
564
565static negotiation_state *parse_accept_headers(request_rec *r)
566{
567 negotiation_state *new =
568 (negotiation_state *) apr_pcalloc(r->pool, sizeof(negotiation_state));
569 accept_rec *elts;
570 apr_table_t *hdrs = r->headers_in;
571 int i;
572
573 new->pool = r->pool;
574 new->r = r;
575 new->conf = (neg_dir_config *)ap_get_module_config(r->per_dir_config,
576 &negotiation_module);
577
578 new->dir_name = ap_make_dirstr_parent(r->pool, r->filename);
579
580 new->accepts = do_header_line(r->pool, apr_table_get(hdrs, "Accept"));
581
582 /* calculate new->accept_q value */
583 if (new->accepts) {
584 elts = (accept_rec *) new->accepts->elts;
585
586 for (i = 0; i < new->accepts->nelts; ++i) {
587 if (elts[i].quality < 1.0) {
588 new->accept_q = 1;
589 }
590 }
591 }
592
593 new->accept_encodings =
594 do_header_line(r->pool, apr_table_get(hdrs, "Accept-Encoding"));
595 new->accept_langs =
596 do_header_line(r->pool, apr_table_get(hdrs, "Accept-Language"));
597 new->accept_charsets =
598 do_header_line(r->pool, apr_table_get(hdrs, "Accept-Charset"));
599
600 /* This is possibly overkill for some servers, heck, we have
601 * only 33 index.html variants in docs/docroot (today).
602 * Make this configurable?
603 */
604 new->avail_vars = apr_array_make(r->pool, 40, sizeof(var_rec));
605
606 return new;
607}
608
609
610static void parse_negotiate_header(request_rec *r, negotiation_state *neg)

Callers 2

handle_map_fileFunction · 0.85
handle_multiFunction · 0.85

Calls 3

ap_get_module_configFunction · 0.85
ap_make_dirstr_parentFunction · 0.85
do_header_lineFunction · 0.85

Tested by

no test coverage detected