Return-Path: Delivered-To: apmail-httpd-apreq-dev-archive@www.apache.org Received: (qmail 67697 invoked from network); 20 Oct 2003 05:19:48 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 20 Oct 2003 05:19:48 -0000 Received: (qmail 65483 invoked by uid 500); 20 Oct 2003 05:19:35 -0000 Delivered-To: apmail-httpd-apreq-dev-archive@httpd.apache.org Received: (qmail 65463 invoked by uid 500); 20 Oct 2003 05:19:34 -0000 Mailing-List: contact apreq-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list apreq-dev@httpd.apache.org Received: (qmail 65446 invoked from network); 20 Oct 2003 05:19:34 -0000 Received: from unknown (HELO theoryx5.uwinnipeg.ca) (142.132.1.82) by daedalus.apache.org with SMTP; 20 Oct 2003 05:19:34 -0000 Received: from theoryx5.uwinnipeg.ca (localhost.localdomain [127.0.0.1]) by theoryx5.uwinnipeg.ca (8.12.8/8.12.8) with ESMTP id h9K5HjHU020531; Mon, 20 Oct 2003 00:17:45 -0500 Received: from localhost (randy@localhost) by theoryx5.uwinnipeg.ca (8.12.8/8.12.8/Submit) with ESMTP id h9K5HjL9020527; Mon, 20 Oct 2003 00:17:45 -0500 Date: Mon, 20 Oct 2003 00:17:45 -0500 (CDT) From: Randy Kobes To: Stas Bekman cc: apreq-dev@httpd.apache.org Subject: Re: [apreq-2] libapreq_cgi and getenv In-Reply-To: <3F935A9F.5050104@stason.org> Message-ID: References: <3F935A9F.5050104@stason.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Sun, 19 Oct 2003, Stas Bekman wrote: > Randy Kobes wrote: > > Hi, > > I've been looking at libapreq_cgi, and am having some > > problems getting cookie data from within a cgi program > > (which I'll describe in a separate message). I don't know if > > this is related, but would there be any objection (or harm?) > > in using, within libapreq_cgi.c, the apr function > > apr_env_get(), rather than getenv(), as in the following: > > +1, apr_env_get is better since it doesn't require running Perl ;) and we use > it in mp2. It's probably faster as well... > > Though since you get a status anyway: > > > s = apr_env_get(&value, "QUERY_STRING", ctx->pool); > > it doesn't hurt to check for failure. Probabaly write a macro to avoid noise > (adopted from mp2): > > + #define APREQ_ASSERT(rc_run) do { \ > + apr_status_t rc = rc_run; \ > + if (rc != APR_SUCCESS) { \ > + ap_log_error(APLOG_MARK, APLOG_ERR, rc, NULL, "failed: "); \ > + } \ > + } while (0) > { > - return getenv("QUERY_STRING"); > + dCTX; > + char *value; > + APREQ_ASSERT(apr_env_get(&value, "QUERY_STRING", ctx->pool)); > + return value; > } > > may be a better error message... Thanks, Stas! That is a good check ... -- best regards, randy