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 jo...@apache.org on 2003/04/25 05:17:48 UTC

cvs commit: httpd-apreq-2/src Makefile.am

joes        2003/04/24 20:17:48

  Modified:    .        buildconf configure.ac
               env      mod_apreq.c
               src      Makefile.am
  Added:       glue/perl Makefile.PL
               glue/perl/c-modules/apreq_test mod_apreq_test.c
               glue/perl/t request.t
  Log:
  Added Apache::Test tests to glue/perl.
  
  Revision  Changes    Path
  1.2       +1 -1      httpd-apreq-2/buildconf
  
  Index: buildconf
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/buildconf,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- buildconf	17 Jan 2003 06:39:43 -0000	1.1
  +++ buildconf	25 Apr 2003 03:17:47 -0000	1.2
  @@ -9,7 +9,7 @@
   
   libtool="libtoolize --automake --copy --force"
   echo "running $libtool" && $libtool && \
  -echo "running aclocal"  && aclocal  && \
  +echo "running aclocal"  && aclocal && \
   echo "running autoconf" && autoconf && \
   echo "running automake -a -c" && automake -a -c && \
   echo "buildconf successful."
  
  
  
  1.4       +1 -1      httpd-apreq-2/configure.ac
  
  Index: configure.ac
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/configure.ac,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- configure.ac	18 Apr 2003 01:32:26 -0000	1.3
  +++ configure.ac	25 Apr 2003 03:17:47 -0000	1.4
  @@ -2,8 +2,8 @@
   
   AC_PREREQ(2.13)
   AC_INIT(libapreq - Apache Request Library, 2.0, apreq-dev@httpd.apache.org, libapreq)
  +AC_CONFIG_AUX_DIR(build)
   AM_INIT_AUTOMAKE
  -dnl AC_CONFIG_AUX_DIR(./build)
   
   AC_PROG_MAKE_SET
   
  
  
  
  1.10      +0 -48     httpd-apreq-2/env/mod_apreq.c
  
  Index: mod_apreq.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/mod_apreq.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mod_apreq.c	23 Apr 2003 07:00:32 -0000	1.9
  +++ mod_apreq.c	25 Apr 2003 03:17:47 -0000	1.10
  @@ -252,58 +252,10 @@
   }
   
   
  -
  -static int test_handler(request_rec *r)
  -{
  -    apr_bucket_brigade *bb;
  -    apreq_request_t *req;
  -    apr_status_t s;
  -    int saw_eos = 1;
  -    dAPREQ_LOG;
  -
  -    if (strcmp(r->handler, "httpd-apreq") != 0)
  -        return DECLINED;
  -
  -    apreq_log(APREQ_DEBUG 0, r, "initializing request");
  -    req = apreq_request(r, NULL);
  -
  -
  -    bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
  -    
  -    do {
  -        apr_bucket *e;
  -        apreq_log(APREQ_DEBUG 0, r, "pulling content thru input filters");
  -        s = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
  -                           APR_BLOCK_READ, HUGE_STRING_LEN);
  -
  -        APR_BRIGADE_FOREACH(e,bb) {
  -            if (APR_BUCKET_IS_EOS(e)) {
  -                saw_eos = 1;
  -                break;
  -            }
  -        }
  -
  -        apr_brigade_cleanup(bb);
  -
  -    } while (!saw_eos);
  -
  -    ap_set_content_type(r, "text/plain");
  -    ap_rputs("GOT APREQ?\n\n",r);
  -
  -    ap_rputs("ARGS:\n");
  -    apreq_table_do(dump_table, r, req->args, NULL);
  -    if (req->body) {
  -        ap_rputs("\nBODY:\n");
  -        apreq_table_do(dump_table, r, req->body, NULL);
  -    }
  -    return OK;
  -}
  -
   static void register_hooks (apr_pool_t *p)
   {
       ap_register_input_filter(filter_name, apreq_filter, NULL, 
                                AP_FTYPE_CONTENT_SET);
  -    ap_hook_handler(test_handler, NULL, NULL, APR_HOOK_MIDDLE);
   }
   
   
  
  
  
  1.1                  httpd-apreq-2/glue/perl/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  use ExtUtils::MakeMaker;
  
  use 5.005;
  
  use lib qw(/home/joe/src/apache/httpd-test/perl-framework/Apache-Test/lib);
  
  use Apache::Test5005compat;
  
  use Apache::TestMM qw(test clean);
  use Apache::TestReport ();
  use Apache::TestSmoke ();
  use Apache::TestRun ();
  
  use File::Find qw(finddepth);
  
  my @scripts = ();
  
  finddepth(sub {
      return unless /(.*?\.pl)\.PL$/;
      push @scripts, "$File::Find::dir/$1";
  }, '.');
  
  Apache::TestMM::filter_args();
  
  for my $script (@scripts) {
      Apache::TestMM::generate_script($script);
  }
  
  for my $util (qw(Report Smoke Run)) {
      my $class = "Apache::Test${util}";
      $class->generate_script;
  }
  
  WriteMakefile(
      NAME => 'httpd-apreq-2',
      VERSION => '0.01',
  #    DIR => [qw(APREQ)],
      clean => { FILES => "@scripts" },
  );
  
  
  
  1.1                  httpd-apreq-2/glue/perl/c-modules/apreq_test/mod_apreq_test.c
  
  Index: mod_apreq_test.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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/>.
   */
  
  #if CONFIG_FOR_HTTPD_TEST
  
  <Location /apreq_test>
     SetHandler httpd-apreq-2
  </Location>
  
  #endif
  
  #define APACHE_HTTPD_TEST_HANDLER apreq_test_handler
  
  #include "apache_httpd_test.h"
  #include "apreq_params.h"
  #include "apreq_env.h"
  #include "httpd.h"
  
  static int dump_table(void *ctx, const char *key, const char *value)
  {
      request_rec *r = ctx;
      ap_rprintf(r, "\t%s => %s\n", key, value);
      return 1;
  }
  
  static int apreq_test_handler(request_rec *r)
  {
      apr_bucket_brigade *bb;
      apreq_request_t *req;
      apr_status_t s;
      int saw_eos = 1;
      dAPREQ_LOG;
  
      if (strcmp(r->handler, "httpd-apreq-2") != 0)
          return DECLINED;
  
      apreq_log(APREQ_DEBUG 0, r, "initializing request");
      req = apreq_request(r, NULL);
  
  
      bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
      
      do {
          apr_bucket *e;
          apreq_log(APREQ_DEBUG 0, r, "pulling content thru input filters");
          s = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
                             APR_BLOCK_READ, HUGE_STRING_LEN);
  
          APR_BRIGADE_FOREACH(e,bb) {
              if (APR_BUCKET_IS_EOS(e)) {
                  saw_eos = 1;
                  break;
              }
          }
  
          apr_brigade_cleanup(bb);
  
      } while (!saw_eos);
  
      ap_set_content_type(r, "text/plain");
      ap_rputs("ARGS:\n",r);
      apreq_table_do(dump_table, r, req->args, NULL);
      if (req->body) {
          ap_rputs("BODY:\n",r);
          apreq_table_do(dump_table, r, req->body, NULL);
      }
      return OK;
  }
  
  APACHE_HTTPD_TEST_MODULE(apreq_test);
  
  
  
  1.1                  httpd-apreq-2/glue/perl/t/request.t
  
  Index: request.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest qw(GET_BODY UPLOAD_BODY);
  
  plan tests => 2;
  
  my $location = '/apreq_test';
  
  ok t_cmp("ARGS:\n\ttest => 1\n", 
          GET_BODY("$location?test=1"), "simple get query");
  
  
  ok t_cmp("ARGS:\n\ttest => 2\nBODY:\n\tHTTPUPLOAD => b\n",
          $_ = UPLOAD_BODY("$location?test=2", content => "unused"), 
          "simple upload");
  
  
  
  1.8       +3 -3      httpd-apreq-2/src/Makefile.am
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/Makefile.am,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Makefile.am	17 Apr 2003 19:19:39 -0000	1.7
  +++ Makefile.am	25 Apr 2003 03:17:48 -0000	1.8
  @@ -2,11 +2,11 @@
   LIBS = -L@APACHE2_LIBS@
   
   lib_LTLIBRARIES = libapreq.la
  -pkginclude_HEADERS = apreq.h apreq_cookie.h apreq_params.h \
  -                     apreq_tables.h apreq_env.h apreq_parsers.h
  +nobase_include_HEADERS = apreq.h apreq_cookie.h apreq_params.h \
  +                         apreq_tables.h apreq_env.h apreq_parsers.h
   libapreq_la_SOURCES = apreq.c apreq_tables.c apreq_cookie.c \
                         apreq_params.c apreq_parsers.c
   libapreq_la_LDFLAGS = -lapr-0 -laprutil-0 -version-info 2:0 
   
   libdir=@APACHE2_LIBS@
  -includedir=@APACHE2_INCLUDES@
  \ No newline at end of file
  +includedir=@APACHE2_INCLUDES@