You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by ra...@apache.org on 2003/10/12 04:37:25 UTC

cvs commit: httpd-apreq-2/win32 test_cgi.mak Configure.pl

randyk      2003/10/11 19:37:25

  Modified:    win32    Configure.pl
  Added:       env      test_cgi.c
               win32    test_cgi.mak
  Log:
  - add env/test_cgi.c, a C cgi script, for testing libapreq_cgi library
  - add rules to Win32 to build this script and copy it to the
    env/t/cgi-bin/ directory.
  
  Revision  Changes    Path
  1.1                  httpd-apreq-2/env/test_cgi.c
  
  Index: test_cgi.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  
  #include "apreq.h"
  #include "apreq_env.h"
  #include "apreq_params.h"
  #include "apreq_parsers.h"
  #include "apreq_cookie.h"
  #include "apr_strings.h"
  #include "apr_lib.h"
  #include "apr_tables.h"
  
  typedef struct env_ctx {
      apr_pool_t         *pool;
      apreq_request_t    *req;
      apreq_jar_t        *jar;
      apr_bucket_brigade *bb;
      int                 loglevel;
      apr_status_t        status;
  } env_ctx;
  
  static int dump_table(void *ctx, const char *key, const char *value)
  {
      env_ctx *c = (env_ctx *) ctx;
      apreq_log(APREQ_DEBUG 0, c, "%s => %s", key, value);
      printf("\t%s => %s\n", key, value);
      return 1;
  }
  
  int main(void)
  {
      apreq_request_t *req;
      env_ctx *ctx;
      apr_pool_t *pool;
      if (apr_initialize() != APR_SUCCESS) {
          fprintf(stderr, "apr_initialize failed\n");
          exit(-1);
      }
      if (apr_pool_create(&pool, NULL) != APR_SUCCESS) {
          fprintf(stderr, "apr_pool_create failed\n");
          exit(-1);
      }
      ctx = (env_ctx *) apr_palloc(pool, sizeof(*ctx));
      ctx->loglevel = 0;
      ctx->pool = pool;
      apreq_log(APREQ_DEBUG 0, ctx, "%s", "Creating apreq_request");
      req = apreq_request(ctx, NULL);
      printf("%s", "Content-Type: text/plain\n\n");
      apreq_log(APREQ_DEBUG 0, ctx, "%s", "Fetching the parameters");
      printf("ARGS:\n");
      apr_table_do(dump_table, ctx, req->args, NULL);
      if (req->body) {
          printf("BODY:\n");
          apr_table_do(dump_table, ctx, req->body, NULL);
      }
      
      apreq_log(APREQ_DEBUG 0, ctx, "%s", "Done!");
  }
  
  
  
  
  1.17      +4 -1      httpd-apreq-2/win32/Configure.pl
  
  Index: Configure.pl
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/win32/Configure.pl,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Configure.pl	10 Oct 2003 04:18:19 -0000	1.16
  +++ Configure.pl	12 Oct 2003 02:37:25 -0000	1.17
  @@ -64,11 +64,13 @@
   }
   
   my $test = << 'END';
  -TEST: $(LIBAPREQ) $(MOD)
  +TEST: $(LIBAPREQ) $(MOD) $(CGI)
   	$(MAKE) /nologo /f $(CFG_HOME)\$(TESTALL).mak CFG="$(TESTALL) - Win32 $(CFG)" APACHE="$(APACHE)" APREQ_HOME="$(APREQ_HOME)"
           set PATH=%PATH%;$(APACHE)\bin
           cd $(LIBDIR) && $(TESTALL).exe -v
           cd $(APREQ_HOME)
  +	$(MAKE) /nologo /f $(CFG_HOME)\$(TESTCGI).mak CFG="$(TESTCGI) - Win32 $(CFG)" APACHE="$(APACHE)" APREQ_HOME="$(APREQ_HOME)"
  +        copy $(LIBDIR)\test_cgi.exe $(APREQ_HOME)\env\t\cgi-bin\test_cgi.exe
   END
   
   my $clean = << 'END';
  @@ -343,6 +345,7 @@
   
   LIBAPREQ=libapreq
   TESTALL=testall
  +TESTCGI=test_cgi
   MOD=mod_apreq
   CGI=libapreq_cgi
   
  
  
  
  1.1                  httpd-apreq-2/win32/test_cgi.mak
  
  Index: test_cgi.mak
  ===================================================================
  # Microsoft Developer Studio Generated NMAKE File, Based on testall.dsp
  
  !IF "$(APACHE)" == ""
  !MESSAGE No Apache directory was specified.
  !MESSAGE This makefile is not to be run directly.
  !MESSAGE Please run Configure.bat, and then $(MAKE) on Makefile.
  !ERROR
  !ENDIF
  
  !IF "$(CFG)" == ""
  CFG=test_cgi - Win32 Release
  !MESSAGE No configuration specified. Defaulting to test_cgi - Win32 Release.
  !ENDIF 
  
  !IF "$(CFG)" != "test_cgi - Win32 Release" && "$(CFG)" != "test_cgi - Win32 Debug"
  !MESSAGE Invalid configuration "$(CFG)" specified.
  !MESSAGE You can specify a configuration when running NMAKE
  !MESSAGE by defining the macro CFG on the command line. For example:
  !MESSAGE 
  !MESSAGE NMAKE /f "test_cgi.mak" CFG="test_cgi - Win32 Debug"
  !MESSAGE 
  !MESSAGE Possible choices for configuration are:
  !MESSAGE 
  !MESSAGE "test_cgi - Win32 Release" (based on "Win32 (x86) Console Application")
  !MESSAGE "test_cgi - Win32 Debug" (based on "Win32 (x86) Console Application")
  !MESSAGE 
  !ERROR An invalid configuration is specified.
  !ENDIF 
  
  !IF "$(OS)" == "Windows_NT"
  NULL=
  !ELSE 
  NULL=nul
  !ENDIF
  
  CFG_HOME=$(APREQ_HOME)\win32
  OUTDIR=$(CFG_HOME)\libs
  INTDIR=$(CFG_HOME)\libs
  
  !IF  "$(CFG)" == "test_cgi - Win32 Release"
  ALL : "$(OUTDIR)\test_cgi.exe"
  
  "$(OUTDIR)" :
      if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
  
  CPP=cl.exe
  CPP_PROJ=/nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /I"$(APACHE)\include" /I"$(APREQ_HOME)\src" /Fp"$(INTDIR)\test_cgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
  
  .c{$(INTDIR)}.obj::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .cpp{$(INTDIR)}.obj::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .cxx{$(INTDIR)}.obj::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .c{$(INTDIR)}.sbr::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .cpp{$(INTDIR)}.sbr::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .cxx{$(INTDIR)}.sbr::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  RSC=rc.exe
  BSC32=bscmake.exe
  BSC32_FLAGS=/nologo /o"$(OUTDIR)\test_cgi.bsc" 
  LINK32=link.exe
  LINK32_FLAGS=kernel32.lib wsock32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\test_cgi.pdb" /machine:I386 /out:"$(OUTDIR)\test_cgi.exe" 
  LINK32_OBJS= \
  	"$(INTDIR)\test_cgi.obj" \
  	"$(OUTDIR)\libapreq_cgi.obj" \
  	"$(OUTDIR)\libapreq.lib" \
  	"$(APACHE)\lib\libapr.lib" \
  	"$(APACHE)\lib\libaprutil.lib"
  
  "$(OUTDIR)\test_cgi.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
      $(LINK32) @<<
    $(LINK32_FLAGS) $(LINK32_OBJS)
  <<
  
  !ELSEIF  "$(CFG)" == "test_cgi - Win32 Debug"
  
  ALL : "$(OUTDIR)\test_cgi.exe"
  
  "$(OUTDIR)" :
      if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
  
  CPP=cl.exe
  CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /I"$(APACHE)\include" /I"$(APREQ_HOME)\src" /Fp"$(INTDIR)\test_cgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c 
  
  .c{$(INTDIR)}.obj::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .cpp{$(INTDIR)}.obj::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .cxx{$(INTDIR)}.obj::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .c{$(INTDIR)}.sbr::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .cpp{$(INTDIR)}.sbr::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  .cxx{$(INTDIR)}.sbr::
     $(CPP) @<<
     $(CPP_PROJ) $< 
  <<
  
  RSC=rc.exe
  BSC32=bscmake.exe
  BSC32_FLAGS=/nologo /o"$(OUTDIR)\test_cgi.bsc" 
  LINK32=link.exe
  LINK32_FLAGS=kernel32.lib wsock32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\test_cgi.pdb" /debug /machine:I386 /out:"$(OUTDIR)\test_cgi.exe" /pdbtype:sept 
  LINK32_OBJS= \
  	"$(INTDIR)\test_cgi.obj" \
  	"$(OUTDIR)\libapreq_cgi.obj" \
  	"$(OUTDIR)\libapreq.lib" \
  	"$(APACHE)\lib\libapr.lib" \
  	"$(APACHE)\lib\libaprutil.lib"
  
  "$(OUTDIR)\test_cgi.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
      $(LINK32) @<<
    $(LINK32_FLAGS) $(LINK32_OBJS)
  <<
  
  !ENDIF 
  
  
  !IF "$(CFG)" == "test_cgi - Win32 Release" || "$(CFG)" == "test_cgi - Win32 Debug"
  
  SOURCE=$(APREQ_HOME)\env\test_cgi.c
  
  "$(INTDIR)\test_cgi.obj" : $(SOURCE) "$(INTDIR)"
  	$(CPP) $(CPP_PROJ) $(SOURCE)
  
  !ENDIF