httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject cvs commit: httpd-apreq-2/env libapreq_cgi.c
Date Mon, 20 Oct 2003 05:25:14 GMT
randyk      2003/10/19 22:25:14

  Modified:    env      libapreq_cgi.c
  Log:
  Reviewed by:	stas
  - use apr_env_get(), rather than getenv().
  - add APREQ_ASSERT macro to log non-APR_SUCCESS calls [stas]
  
  Revision  Changes    Path
  1.11      +15 -4     httpd-apreq-2/env/libapreq_cgi.c
  
  Index: libapreq_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/libapreq_cgi.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- libapreq_cgi.c	14 Oct 2003 18:53:30 -0000	1.10
  +++ libapreq_cgi.c	20 Oct 2003 05:25:14 -0000	1.11
  @@ -59,6 +59,7 @@
   #include "apreq_cookie.h"
   #include "apr_strings.h"
   #include "apr_lib.h"
  +#include "apr_env.h"
   
   #include <stdlib.h>
   #include <stdio.h>
  @@ -94,6 +95,12 @@
   
   #define CRLF "\015\012"
   
  +#define APREQ_ASSERT(rc_run) do { \
  +         apr_status_t rc = rc_run; \
  +         if (rc != APR_SUCCESS) { \
  +             apreq_log(APREQ_DEBUG 0, ctx, "failed: %d", rc); \
  +         } \
  +     } while (0)
   
   APREQ_DECLARE(apr_pool_t *)apreq_env_pool(void *env)
   {
  @@ -103,14 +110,18 @@
   
   APREQ_DECLARE(const char *)apreq_env_query_string(void *env)
   {
  -    return getenv("QUERY_STRING");
  +    dCTX;
  +    char *value;
  +    APREQ_ASSERT(apr_env_get(&value, "QUERY_STRING", ctx->pool));
  +    return value;
   }
  +
   APREQ_DECLARE(const char *)apreq_env_header_in(void *env, 
                                                  const char *name)
   {
       dCTX;
       char *key = apr_pstrdup(ctx->pool, name);
  -    char *k;
  +    char *k, *value;
       for (k = key; *k; ++k) {
           if (*k == '-')
               *k = '_';
  @@ -118,8 +129,8 @@
               *k = apr_toupper(*k);
       }
   
  -
  -    return getenv(key);
  +    APREQ_ASSERT(apr_env_get(&value, key, ctx->pool));
  +    return value;
   }
   
   APREQ_DECLARE(apr_status_t)apreq_env_header_out(void *ctx, const char *name, 
  
  
  

Mime
View raw message