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

Function x_handler

modules/examples/mod_example_hooks.c:971–1082  ·  view source on GitHub ↗

--------------------------------------------------------------------------*/ / Now we declare our content handlers, which are invoked when the server */ encounters a document which our module is supposed to have a chance to */ see. (See mod_mime's SetHandler and AddHandler directives, and the */ mod_info and mod_status examples, for more details.) */ / Since content h

Source from the content-addressed store, hash-verified

969 * This is a RUN_FIRST hook.
970 */
971static int x_handler(request_rec *r)
972{
973 x_cfg *dcfg;
974 char *note;
975 void *conn_data;
976 apr_status_t status;
977
978 dcfg = our_dconfig(r);
979 /*
980 * Add our trace to the log, and whether we get to write
981 * content for this request.
982 */
983 note = apr_pstrcat(r->pool, "x_handler(), handler is \"",
984 r->handler, "\"", NULL);
985 trace_request(r, note);
986
987 /* If it's not for us, get out as soon as possible. */
988 if (strcmp(r->handler, "example-hooks-handler")) {
989 return DECLINED;
990 }
991
992 /*
993 * Set the Content-type header. Note that we do not actually have to send
994 * the headers: this is done by the http core.
995 */
996 ap_set_content_type_ex(r, "text/html", 1);
997 /*
998 * If we're only supposed to send header information (HEAD request), we're
999 * already there.
1000 */
1001 if (r->header_only) {
1002 return OK;
1003 }
1004
1005 /*
1006 * Now send our actual output. Since we tagged this as being
1007 * "text/html", we need to embed any HTML.
1008 */
1009 ap_rputs(DOCTYPE_HTML_4_01, r);
1010 ap_rputs("<HTML>\n", r);
1011 ap_rputs(" <HEAD>\n", r);
1012 ap_rputs(" <TITLE>mod_example_hooks Module Content-Handler Output\n", r);
1013 ap_rputs(" </TITLE>\n", r);
1014 ap_rputs(" </HEAD>\n", r);
1015 ap_rputs(" <BODY>\n", r);
1016 ap_rputs(" <H1><SAMP>mod_example_hooks</SAMP> Module Content-Handler Output\n", r);
1017 ap_rputs(" </H1>\n", r);
1018 ap_rputs(" <P>\n", r);
1019 ap_rprintf(r, " Apache HTTP Server version: \"%s\"\n",
1020 ap_get_server_banner());
1021 ap_rputs(" <BR>\n", r);
1022 ap_rprintf(r, " Server built: \"%s\"\n", ap_get_server_built());
1023 ap_rputs(" </P>\n", r);
1024 ap_rputs(" <P>\n", r);
1025 ap_rputs(" The format for the callback trace is:\n", r);
1026 ap_rputs(" </P>\n", r);
1027 ap_rputs(" <DL>\n", r);
1028 ap_rputs(" <DT><EM>n</EM>.<SAMP>&lt;routine-name&gt;", r);

Callers

nothing calls this directly

Calls 7

our_dconfigFunction · 0.85
trace_requestFunction · 0.85
ap_set_content_type_exFunction · 0.85
ap_rputsFunction · 0.85
ap_rprintfFunction · 0.85
ap_get_server_bannerFunction · 0.85
ap_get_server_builtFunction · 0.85

Tested by

no test coverage detected