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

Function trace_connection

modules/examples/mod_example_hooks.c:440–482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438#define CONN_NOTE "example-hooks-connection"
439
440static void trace_connection(conn_rec *c, const char *note)
441{
442 const char *trace_copy, *sofar;
443 char *addon, *where;
444 void *data;
445 x_cfg *cfg;
446
447#if EXAMPLE_LOG_EACH
448 example_log_each(c->pool, c->base_server, note);
449#endif
450
451 cfg = our_cconfig(c);
452
453 where = (cfg != NULL) ? cfg->loc : "nowhere";
454 where = (where != NULL) ? where : "";
455
456 addon = apr_pstrcat(c->pool,
457 " <li>\n"
458 " <dl>\n"
459 " <dt><samp>", note, "</samp></dt>\n"
460 " <dd><samp>[", where, "]</samp></dd>\n"
461 " </dl>\n"
462 " </li>\n",
463 NULL);
464
465 /* Find existing notes and copy */
466 apr_pool_userdata_get(&data, CONN_NOTE, c->pool);
467 sofar = (data == NULL) ? "" : (const char *) data;
468
469 /* Tack addon onto copy */
470 trace_copy = apr_pstrcat(c->pool, sofar, addon, NULL);
471
472 /*
473 * Stash copy back into pool notes. This call has a cleanup
474 * parameter, but we're not using it because the string has been
475 * allocated from that same pool. There is also an unused return
476 * value: we have nowhere to communicate any error that might
477 * occur, and will have to check for the existence of this data on
478 * the other end.
479 */
480 apr_pool_userdata_set((const void *) trace_copy, CONN_NOTE,
481 NULL, c->pool);
482}
483
484static void trace_nocontext(apr_pool_t *p, const char *file, int line,
485 const char *note)

Callers 2

x_pre_connectionFunction · 0.85
x_process_connectionFunction · 0.85

Calls 2

example_log_eachFunction · 0.85
our_cconfigFunction · 0.85

Tested by

no test coverage detected