Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 2857 invoked by uid 6000); 27 Sep 1999 15:26:06 -0000 Received: (qmail 2837 invoked from network); 27 Sep 1999 15:26:03 -0000 Received: from r83aap004553.lnh.md.cable.rcn.com (HELO www.talk7.com) (@209.122.170.81) by taz.hyperreal.org with SMTP; 27 Sep 1999 15:26:03 -0000 Received: from localhost (peterw@localhost) by www.talk7.com (8.9.3/8.8.7) with ESMTP id LAA13275 for ; Mon, 27 Sep 1999 11:25:54 -0400 X-Authentication-Warning: www.talk7.com: peterw owned process doing -bs Date: Mon, 27 Sep 1999 11:25:54 -0400 (EDT) From: Peter W X-Sender: peterw@localhost To: new-httpd@apache.org Subject: [PATCH] mod_log_config: expose r->protocol, r->method Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org For a recent project, we wanted to customize the log format and realized that while %r refers to the full request line and %U refers to the uri, there was no good way to refer to the method or protocol. Since the request structure already has protocol and method members, I added code to src/modules/standard/mod_log_config.c to add % LogFormat shortcuts: %m => r->method (mnemonic: "m" for "method") %H => r->protocol (mnemonic: "H" begins "HTTP/1.0") The attached patch is a diff -c against the source for mod_log_config.c in the latest CVS tarball (http://dev.apache.org/from-cvs/apache-1.3/apache-1.3_19990927131226.tar.gz) -Peter Watkins *** mod_log_config.c.cvs19990927131226 Mon Sep 27 10:51:42 1999 --- mod_log_config.c Mon Sep 27 10:52:02 1999 *************** *** 334,339 **** --- 334,347 ---- { return r->uri; } + static const char *log_request_method(request_rec *r, char *a) + { + return r->method; + } + static const char *log_request_protocol(request_rec *r, char *a) + { + return r->protocol; + } static const char *log_status(request_rec *r, char *a) { return pfmt(r->pool, r->status); *************** *** 505,510 **** --- 513,524 ---- }, { 'P', log_child_pid, 0 + }, + { + 'H', log_request_protocol, 0 + }, + { + 'm', log_request_method, 0 }, { '\0'