static const char * yahoo_footer_compression_type(request_rec *r)
{
  int flags = r->connection->client->flags;

  if (flags & B_GZIP_CHUNK)
    return "compressed/chunked";
  else if (flags & B_GZIP)
    return "compressed";
  else if (flags & B_CHUNK)
    return "uncompressed/chunked";
  else
    return "uncompressed";
}


static int yahoo_footer_check_content_type(request_rec *r)
{
  const char *ctype = ap_table_get(r->headers_out, "Content-Type");

  if (ctype != NULL &&
      (strncasecmp(ctype, "text/html", 9) == 0 ||
       strncasecmp(ctype, "text/xml", 8) == 0 ||
       strncasecmp(ctype, "application/xml", 15) == 0))
  {
    return 1;
  }
  else
  {
    return 0;
  }
}

static const char * yahoo_gethostname()
{
  static host_init = 0;
  static char host[MAXHOSTNAMELEN] = "unknown";

  if (!host_init)
  {
    (void) gethostname(host, sizeof(host) - 1);
    host_init = 1;
  }

  return host;
}

API_EXPORT(void) ap_finalize_request_protocol(request_rec *r)
{
#ifdef YAHOO
  if (!r->next && !r->header_only && !r->proxyreq &&
      yahoo_footer_check_content_type(r) &&
      !ap_table_get(r->headers_out, "Content-Length") &&
      !ap_table_get(r->headers_out, "Content-Range"))
  {
    ap_hard_timeout("send pre-finalize body", r);
    ap_rvputs(r, "<!-- ", yahoo_gethostname(), " ",
              yahoo_footer_compression_type(r), " ",
              ap_gm_timestr_822(r->pool, r->request_time),
              " -->\n", NULL);
    ap_kill_timeout(r);
  }
#endif /* YAHOO */
  /* rest of ap_finalize_request_protocol() follows */
}