httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zeus Capricorn" <>
Subject nothing in the r->headers_out?
Date Wed, 06 Jun 2007 06:07:56 GMT
      I was reading Nick's book these days,and i got in trouble in chapter 5

      it does print the r->headers_in(Host,Accept,etc.),but nothing
else.Where is the r->headers_out and r->subprocess_env?

      Thanks in advance.

The code goes here:
static int printitem(void *rec, const char *key, const char *value)
/* rec is a user data pointer.  We'll pass the request_rec in it. */
request_rec *r = rec;
ap_rprintf(r, "<tr><th scope=\"row\">%s</th><td>%s</td></tr>\n",
ap_escape_html(r->pool, key),
ap_escape_html(r->pool, value));
/* Zero would stop iterating; any other return value continues */
return 1;
static void printtable(request_rec *r, apr_table_t *t,
const char *caption, const char *keyhead,
const char *valhead)
/* Print a table header */
ap_rprintf(r, "<table><caption>%s</caption><thead>"
                 "<tr><th scope=\"col\">%s</th><th scope=\"col\">%s"
                 "</th></tr></thead><tbody>", caption, keyhead, valhead);
/* Print the data: apr_table_do iterates over entries with
* our callback
apr_table_do(printitem, r, t, NULL);
/* Finish the table */
ap_rputs("</tbody></table>\n", r);
static int helloworld_handler(request_rec *r)
if (!r->handler || (strcmp(r->handler, "helloworld") != 0)) {
return DECLINED ;
if (r->method_number != M_GET) {
ap_set_content_type(r, "text/html;charset=ascii");
ap_rputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n"
    "<html><head><title>Apache HelloWorld Module</title></head>"
    "<body><h1>Hello World!</h1>"
    "<p>This is the Apache HelloWorld module!</p>", r);
/* Print the tables */
printtable(r, r->headers_in, "Request Headers", "Header", "Value");
printtable(r, r->headers_out, "Response Headers", "Header", "Value");
printtable(r, r->subprocess_env, "Environment", "Variable", "Value");
ap_rputs("</body></html>", r);
return OK;

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message