Author: joes
Date: Fri Feb 18 14:07:36 2005
New Revision: 154358

URL: http://svn.apache.org/viewcvs?view=rev&rev=154358
Log:
  - Add apreq_error.h, apreq_module.h.
  - Rename apreq_run* and apreq_make* funcs to conform with 
    apreq_$obj_$meth scheme.
  - Replace c->version & c->secure with flags.
  - Parsers are assumed to be working with external data, so the
    cookies & params they produce are marked tainted.

Added:
    httpd/apreq/branches/multi-env-unstable/glue/perl/t/api/
    httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/
    
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/cookie.pm
    
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/param.pm
    
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h
    
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm
    
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
    httpd/apreq/branches/multi-env-unstable/include/apreq_error.h
    httpd/apreq/branches/multi-env-unstable/include/apreq_module.h
    httpd/apreq/branches/multi-env-unstable/library/error.c
    httpd/apreq/branches/multi-env-unstable/library/t/error.c
Modified:
    httpd/apreq/branches/multi-env-unstable/CHANGES
    httpd/apreq/branches/multi-env-unstable/build/doxygen.conf.in
    httpd/apreq/branches/multi-env-unstable/build/xsbuilder.pl
    httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL
    httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t
    httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cgi.t
    httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cookie.t
    httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/inherit.t
    httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/request.t
    httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/upload.t
    
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs
    
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.xs
    
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h
    
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_structures.map
    
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map
    httpd/apreq/branches/multi-env-unstable/include/apreq.h
    httpd/apreq/branches/multi-env-unstable/include/apreq_cookie.h
    httpd/apreq/branches/multi-env-unstable/include/apreq_param.h
    httpd/apreq/branches/multi-env-unstable/include/apreq_parser.h
    httpd/apreq/branches/multi-env-unstable/include/apreq_util.h
    httpd/apreq/branches/multi-env-unstable/include/apreq_version.h
    httpd/apreq/branches/multi-env-unstable/library/Makefile.am
    httpd/apreq/branches/multi-env-unstable/library/cookie.c
    httpd/apreq/branches/multi-env-unstable/library/module.c
    httpd/apreq/branches/multi-env-unstable/library/module_cgi.c
    httpd/apreq/branches/multi-env-unstable/library/module_custom.c
    httpd/apreq/branches/multi-env-unstable/library/param.c
    httpd/apreq/branches/multi-env-unstable/library/parser.c
    httpd/apreq/branches/multi-env-unstable/library/parser_header.c
    httpd/apreq/branches/multi-env-unstable/library/parser_multipart.c
    httpd/apreq/branches/multi-env-unstable/library/parser_urlencoded.c
    httpd/apreq/branches/multi-env-unstable/library/t/Makefile.am
    httpd/apreq/branches/multi-env-unstable/library/t/cookie.c
    httpd/apreq/branches/multi-env-unstable/library/t/params.c
    httpd/apreq/branches/multi-env-unstable/library/t/parsers.c
    httpd/apreq/branches/multi-env-unstable/library/util.c
    
httpd/apreq/branches/multi-env-unstable/module/apache2/apreq_module_apache2.h
    httpd/apreq/branches/multi-env-unstable/module/apache2/filter.c
    httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c
    
httpd/apreq/branches/multi-env-unstable/module/t/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c
    httpd/apreq/branches/multi-env-unstable/module/test_cgi.c

Modified: httpd/apreq/branches/multi-env-unstable/CHANGES
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/CHANGES?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/CHANGES (original)
+++ httpd/apreq/branches/multi-env-unstable/CHANGES Fri Feb 18 14:07:36 2005
@@ -2,8 +2,16 @@
 @brief List of major changes.
 
 
[EMAIL PROTECTED] v2_05 Changes with libapreq2-2.05
[EMAIL PROTECTED] v2_05_dev Changes with libapreq2-2.05-dev
 
+
+- C API [joes]
+  - Add apreq_error.h, apreq_module.h.
+  - Rename apreq_run* and apreq_make* funcs to conform with 
+    apreq_$obj_$meth scheme.
+  - Replace c->version & c->secure with flags.
+  - Parsers are assumed to be working with external data, so the
+    cookies & params they produce are marked tainted.
 
 - C API [joes]
   apreq_parse_cookie_header() failed to parse RFC Cookie headers which

Modified: httpd/apreq/branches/multi-env-unstable/build/doxygen.conf.in
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/build/doxygen.conf.in?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/build/doxygen.conf.in (original)
+++ httpd/apreq/branches/multi-env-unstable/build/doxygen.conf.in Fri Feb 18 
14:07:36 2005
@@ -8,7 +8,7 @@
 REPEAT_BRIEF           = YES
 
 TAB_SIZE               = 8
-ALIASES                = 
+ALIASES                = "[EMAIL PROTECTED] The request handle.\n"
 OPTIMIZE_OUTPUT_FOR_C  = YES
 
 INTERNAL_DOCS          = NO

Modified: httpd/apreq/branches/multi-env-unstable/build/xsbuilder.pl
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/build/xsbuilder.pl?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/build/xsbuilder.pl (original)
+++ httpd/apreq/branches/multi-env-unstable/build/xsbuilder.pl Fri Feb 18 
14:07:36 2005
@@ -115,7 +115,7 @@
     # ExtUtils::XSBuilder::C::grammar
 
     for ($_[1]) {
-        ::c_macro("APREQ_DECLARE", "apreq_util.h")->();
+        ::c_macro("APREQ_DECLARE", "apreq.h")->();
         ::c_macro("APREQ_DECLARE_HOOK", "apreq_parser.h")->();
         ::c_macro("APREQ_DECLARE_PARSER", "apreq_parser.h")->();
         ::c_macro("APR_DECLARE")->();

Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL (original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL Fri Feb 18 
14:07:36 2005
@@ -559,6 +559,11 @@
                             INPUT  => '$var = 
((apreq_cookie_version_t)SvTRUE($arg))',
                             OUTPUT => '$arg = boolSV((bool)$var);',
                            },
+    T_APREQ_ERROR => {
+                          INPUT => '$var = (HV *)SvRV($arg)',
+                          OUTPUT => '$arg = sv_bless(newRV_noinc((SV*)$var), 
gv_stashpvn(\"${ntype}\", sizeof(\"${ntype}\") - 1, FALSE);'
+                     },
+
         T_HASHOBJ       => {
                             INPUT => <<'EOT', # '$var = 
modperl_hash_tied_object(aTHX_ \"${ntype}\", $arg)'
     if (sv_derived_from($arg, \"${ntype}\")) {

Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t 
(original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t Fri 
Feb 18 14:07:36 2005
@@ -18,7 +18,7 @@
 my @big_key_num = (5, 15, 25);
 my @big_keys    = ('a'..'z');
 
-plan tests => @key_len * @key_num + @big_key_len * @big_key_num;
+plan tests => @key_len * @key_num + @big_key_len * @big_key_num, 
under_construction;
 
 
 # GET

Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cgi.t
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cgi.t?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cgi.t (original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cgi.t Fri Feb 18 
14:07:36 2005
@@ -36,7 +36,7 @@
 my @big_keys    = ('a'..'z');
 
 plan tests => 10 + @key_len * @key_num + @big_key_len * @big_key_num +
-  @names * @methods, have_lwp && have_cgi;
+  @names * @methods, under_construction;#, have_lwp, have_cgi;
 
 my $location = '/cgi-bin';
 my $script = $location . '/test_cgi.pl';

Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cookie.t
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cookie.t?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cookie.t 
(original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/cookie.t Fri Feb 
18 14:07:36 2005
@@ -6,7 +6,7 @@
 use Apache::TestUtil;
 use Apache::TestRequest qw(GET_BODY GET_HEAD);
 
-plan tests => 7, have_lwp;
+plan tests => 7, under_construction; # have_lwp
 
 require HTTP::Cookies;
 

Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/inherit.t
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/inherit.t?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/inherit.t 
(original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/inherit.t Fri Feb 
18 14:07:36 2005
@@ -6,7 +6,7 @@
 use Apache::TestUtil;
 use Apache::TestRequest qw(GET_BODY UPLOAD_BODY);
 
-plan tests => 4;
+plan tests => 4, under_construction;
 my $location = "/TestApReq__inherit";
 my @response = split/\r?\n/, GET_BODY($location, Cookie=>"apache=2");
 ok t_cmp($response[0], "method => GET", "inherit method");

Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/request.t
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/request.t?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/request.t 
(original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/request.t Fri Feb 
18 14:07:36 2005
@@ -6,7 +6,7 @@
 use Apache::TestUtil;
 use Apache::TestRequest qw(GET_BODY UPLOAD_BODY);
 
-plan tests => 18, have_lwp;
+plan tests => 18, under_construction;#have_lwp
 
 my $location = "/TestApReq__request";
 #print GET_BODY $location;

Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/upload.t
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/upload.t?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/upload.t 
(original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/upload.t Fri Feb 
18 14:07:36 2005
@@ -17,7 +17,7 @@
 my @names = sort keys %types;
 my @methods = sort qw/slurp fh tempname link io/;
 
-plan tests => @names * @methods, have_lwp;
+plan tests => @names * @methods, under_construction; # have_lwp
 
 foreach my $name (@names) {
     my $url = ( ($name =~ /\.pod$/) ?

Added: 
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/cookie.pm
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/cookie.pm?view=auto&rev=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/cookie.pm 
(added)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/cookie.pm 
Fri Feb 18 14:07:36 2005
@@ -0,0 +1,23 @@
+package TestAPI::cookie;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+
+use APR::Request::Cookie;
+use APR::Request::Apache2;
+
+sub handler {
+    my $r = shift;
+    plan $r, tests => 1;
+
+    my $req = APR::Request::Apache2->new($r);
+    ok not defined $req->jar;
+
+    return 0;
+}
+
+
+1;

Added: 
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/param.pm
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/param.pm?view=auto&rev=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/param.pm 
(added)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/param.pm 
Fri Feb 18 14:07:36 2005
@@ -0,0 +1,23 @@
+package TestAPI::param;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+
+use APR::Request::Param;
+use APR::Request::Apache2;
+
+sub handler {
+    my $r = shift;
+    plan $r, tests => 1;
+
+    my $req = APR::Request::Apache2->new($r);
+    ok not defined $req->args;
+
+    return 0;
+}
+
+
+1;

Added: 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h?view=auto&rev=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h
 (added)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Apache2/APR__Request__Apache2.h
 Fri Feb 18 14:07:36 2005
@@ -0,0 +1 @@
+#include "mod_perl.h"

Modified: 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs?view=diff&r1=154357&r2=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs
 (original)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs
 Fri Feb 18 14:07:36 2005
@@ -9,11 +9,24 @@
 }
 
 static APR_INLINE
-SV *apreq_xs_jar2sv(pTHX_ const apr_table_t *t, const char *class, SV *handle)
+SV *apreq_xs_table2sv(pTHX_ const apr_table_t *t, const char *class, SV 
*handle)
 {
+    SV *sv = (SV *)newHV();
     SV *rv = sv_setref_pv(newSV(0), class, (void *)t);
     sv_magic(SvRV(rv), handle, PERL_MAGIC_ext, Nullch, 0);
-    return rv;
+
+#if (PERL_VERSION >= 8) /* MAGIC ITERATOR requires 5.8 */
+
+    sv_magic(sv, NULL, PERL_MAGIC_ext, Nullch, -1);
+    SvMAGIC(sv)->mg_virtual = (MGVTBL *)&apreq_xs_table_magic;
+    SvMAGIC(sv)->mg_flags |= MGf_COPY;
+
+#endif
+
+    sv_magic(sv, rv, PERL_MAGIC_tied, Nullch, 0);
+    SvREFCNT_dec(rv); /* corrects SvREFCNT_inc(rv) implicit in sv_magic */
+
+    return sv_bless(newRV_noinc(sv), SvSTASH(SvRV(rv)));
 }
 
 static int apreq_xs_table_values(void *data, const char *key, const char *val)
@@ -60,8 +73,8 @@
             apr_status_t s;
 
             s = apreq_jar(req, &t);
-            if (s != APR_SUCCESS && !sv_derived_from(sv, error_pkg))
-                APREQ_XS_THROW_ERROR("r", s, "APR::Request::jar", error_pkg);
+            if (apreq_status_is_error(s))
+                APREQ_XS_THROW_ERROR(r, s, "APR::Request::jar", error_pkg);
 
             XSRETURN_UNDEF;
         }
@@ -72,8 +85,12 @@
         apr_status_t s;
 
         s = apreq_jar(req, &t);
-        if (s != APR_SUCCESS && !sv_derived_from(sv, error_pkg))
-            APREQ_XS_THROW_ERROR("r", s, "APR::Request::jar", error_pkg);
+
+        if (apreq_status_is_error(s))
+            APREQ_XS_THROW_ERROR(r, s, "APR::Request::jar", error_pkg);
+
+        if (t == NULL)
+            XSRETURN_EMPTY;
 
         d.pkg = cookie_pkg;
         d.parent = obj;
@@ -91,7 +108,7 @@
             return;
 
         case G_SCALAR:
-            ST(0) = apreq_xs_jar2sv(aTHX_ t, jar_pkg, obj);
+            ST(0) = apreq_xs_table2sv(aTHX_ t, jar_pkg, obj);
             sv_2mortal(ST(0));
             XSRETURN(1);
 

Modified: 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.xs
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.xs?view=diff&r1=154357&r2=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.xs
 (original)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.xs
 Fri Feb 18 14:07:36 2005
@@ -74,10 +74,10 @@
             apr_status_t s;
             s = apreq_args(req, &t);
 
-            if (s != APR_SUCCESS && !sv_derived_from(sv, error_pkg))
-                APREQ_XS_THROW_ERROR("r", s, "APR::Request::args", error_pkg);
+            if (apreq_status_is_error(s))
+                APREQ_XS_THROW_ERROR(r, s, "APR::Request::args", error_pkg);
 
-        XSRETURN_UNDEF;
+            XSRETURN_UNDEF;
         }
     }
     else {
@@ -87,8 +87,11 @@
 
         s = apreq_args(req, &t);
 
-        if (s != APR_SUCCESS && !sv_derived_from(sv, error_pkg))
-            APREQ_XS_THROW_ERROR("r", s, "APR::Request::args", error_pkg);
+        if (apreq_status_is_error(s))
+            APREQ_XS_THROW_ERROR(r, s, "APR::Request::args", error_pkg);
+
+        if (t == NULL)
+            XSRETURN_EMPTY;
 
         d.pkg = elt_pkg;
         d.parent = obj;
@@ -148,10 +151,10 @@
             apr_status_t s;
             s = apreq_body(req, &t);
 
-            if (s != APR_SUCCESS && !sv_derived_from(sv, error_pkg))
-                APREQ_XS_THROW_ERROR("r", s, "APR::Request::args", error_pkg);
+            if (apreq_status_is_error(s))
+                APREQ_XS_THROW_ERROR(r, s, "APR::Request::body", error_pkg);
 
-        XSRETURN_UNDEF;
+            XSRETURN_UNDEF;
         }
     }
     else {
@@ -161,8 +164,11 @@
 
         s = apreq_body(req, &t);
 
-        if (s != APR_SUCCESS && !sv_derived_from(sv, error_pkg))
-            APREQ_XS_THROW_ERROR("r", s, "APR::Request::body", error_pkg);
+        if (apreq_status_is_error(s))
+            APREQ_XS_THROW_ERROR(r, s, "APR::Request::body", error_pkg);
+
+        if (t == NULL)
+            XSRETURN_EMPTY;
 
         d.pkg = elt_pkg;
         d.parent = obj;

Added: 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm?view=auto&rev=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm
 (added)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm
 Fri Feb 18 14:07:36 2005
@@ -0,0 +1,5 @@
+{
+    package APR::Request::Error;
+    require APR::Error;
+    push our @ISA, qw/APR::Error APR::Request/;
+}

Added: 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs?view=auto&rev=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
 (added)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
 Fri Feb 18 14:07:36 2005
@@ -0,0 +1,40 @@
+static XS(XS_APR__Request__Error_nil)
+{
+    dXSARGS;
+    (void)items;
+    XSRETURN_EMPTY;
+}
+
+
+MODULE = APR::Request       PACKAGE = APR::Request::Error
+
+SV *as_string(hv, p1=NULL, p2=NULL)
+    APR::Request::Error hv
+    SV *p1
+    SV *p2
+  PREINIT:
+    SV **svp;
+
+  CODE:
+    svp = hv_fetch(hv, "rc", 2, FALSE);
+    if (svp == NULL)
+        RETVAL = &PL_sv_undef;
+    else
+        RETVAL = apreq_xs_strerror(aTHX_ SvIVX(*svp));
+
+  OUTPUT:
+    RETVAL
+
+BOOT:
+    /* register the overloading (type 'A') magic */
+    PL_amagic_generation++;
+    /* The magic for overload gets a GV* via gv_fetchmeth as */
+    /* mentioned above, and looks in the SV* slot of it for */
+    /* the "fallback" status. */
+    sv_setsv(
+        get_sv( "APR::Request::Error::()", TRUE ),
+        &PL_sv_undef
+    );
+    newXS("APR::Request::Error::()", XS_APR__Request__Error_nil, file);
+    newXS("APR::Request::Error::(\"\"", XS_APR__Request__Error_as_string, 
file);
+

Modified: 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h?view=diff&r1=154357&r2=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h 
(original)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h 
Fri Feb 18 14:07:36 2005
@@ -31,6 +31,7 @@
 typedef apreq_handle_t apreq_handle_apache2_t;
 typedef apr_table_t    apreq_param_table_t;
 typedef apr_table_t    apreq_cookie_table_t;
+typedef HV apreq_xs_error_t;
 
 /**
  * @file apreq_xs_postperl.h
@@ -288,11 +289,18 @@
 #define APREQ_XS_THROW_ERROR(attr, status, func, errpkg)  do {          \
     if (!sv_derived_from(sv, errpkg)) {                                 \
         HV *hv = newHV();                                               \
-        SV *rv = newRV_inc(obj);                                        \
+        SV *rv = newRV_inc(SvRV(obj));                                  \
         sv_setsv(*hv_fetch(hv, "_" #attr, 2, 1), sv_2mortal(rv));       \
         apreq_xs_croak(aTHX_ hv, status, func, errpkg);                 \
     }                                                                   \
 } while (0)
+
+static APR_INLINE
+SV *apreq_xs_strerror(pTHX_ apr_status_t s) {
+    char buf[256];
+    apreq_strerror(s, buf, sizeof buf);
+    return newSVpv(buf, 0);
+}
 
 
 /** @} */

Modified: 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_structures.map
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_structures.map?view=diff&r1=154357&r2=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_structures.map
 (original)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_structures.map
 Fri Feb 18 14:07:36 2005
@@ -25,11 +25,9 @@
 </apreq_handle_t>
 
 <apreq_cookie_t MODULE=APR::Request::Cookie>
-  version
   path
   domain
   port
-  secure
   comment
   commentURL
 ! max_age

Modified: 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map?view=diff&r1=154357&r2=154358
==============================================================================
--- 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map
 (original)
+++ 
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map
 Fri Feb 18 14:07:36 2005
@@ -12,7 +12,7 @@
 #apreq_cookie_version_t | APREQ_COOKIE_VERSION
 
 #data structure stuff
-struct request_rec | Apache::RequestRec | T_PTR | r
+struct request_rec | Apache::RequestRec | T_APACHEOBJ | r
 struct apr_pool_t           | APR::Pool | T_POOLOBJ
 struct apr_array_header_t   | APR::ArrayHeader
 struct apr_table_t          | APR::Table | T_HASHOBJ
@@ -26,4 +26,5 @@
 struct apreq_handle_t         | APR::Request          | T_APREQ_HANDLE
 struct apreq_handle_apache2_t | APR::Request::Apache2 | T_APREQ_HANDLE_APACHE2
 struct apreq_handle_cgi_t     | APR::Request::CGI     | T_APREQ_HANDLE
+struct apreq_xs_error_t       | APR::Request::Error   | T_APREQ_ERROR
 

Modified: httpd/apreq/branches/multi-env-unstable/include/apreq.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/include/apreq.h?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq.h Fri Feb 18 14:07:36 
2005
@@ -17,324 +17,91 @@
 #ifndef APREQ_H
 #define APREQ_H
 
-#include "apreq_cookie.h"
-#include "apreq_param.h"
-#include "apreq_parser.h"
+#include "apr_tables.h"
+#include <stddef.h>
 
 #ifdef  __cplusplus
  extern "C" {
 #endif 
 
-/**
- * An apreq environment, associated with an env module. The structure
- * may have variable size, because the module may append its own data
- * structures after it.
- */
-typedef struct apreq_handle_t {
-    const struct apreq_module_t *module;
-} apreq_handle_t;
-
-/**
- * This must be fully defined for libapreq2 to operate properly 
- * in a given environment. Normally it is set once, with an apreq_env_module() 
- * call during process initialization, and should remain fixed thereafter.
- * @brief Vtable describing the necessary environment functions.
- */
-
-
-typedef struct apreq_module_t {
-    const char *name;
-    apr_uint32_t magic_number;
-
-    apr_status_t (*jar)(apreq_handle_t *, const apr_table_t **);
-    apr_status_t (*args)(apreq_handle_t *, const apr_table_t **);
-    apr_status_t (*body)(apreq_handle_t *, const apr_table_t **);
-
-    apreq_cookie_t *(*jar_get)(apreq_handle_t *, const char *);
-    apreq_param_t *(*args_get)(apreq_handle_t *, const char *);
-    apreq_param_t *(*body_get)(apreq_handle_t *, const char *);
-
-    apr_status_t (*parser_get)(apreq_handle_t *, const apreq_parser_t **);
-    apr_status_t (*parser_set)(apreq_handle_t *, apreq_parser_t *);
-    apr_status_t (*hook_add)(apreq_handle_t *, apreq_hook_t *);
-
-    apr_status_t (*brigade_limit_get)(apreq_handle_t *, apr_size_t *);
-    apr_status_t (*brigade_limit_set)(apreq_handle_t *, apr_size_t);
-
-    apr_status_t (*read_limit_get)(apreq_handle_t *, apr_uint64_t *);
-    apr_status_t (*read_limit_set)(apreq_handle_t *, apr_uint64_t);
-
-    apr_status_t (*temp_dir_get)(apreq_handle_t *, const char **);
-    apr_status_t (*temp_dir_set)(apreq_handle_t *, const char *);
-
-    const char *(*header_in)(apreq_handle_t *,const char *);
-    apr_status_t (*header_out)(apreq_handle_t *, const char *,char *);
-
-} apreq_module_t;
-
-
-
-static APR_INLINE
-apr_status_t apreq_jar(apreq_handle_t *env, const apr_table_t **t)
-{
-    return env->module->jar(env,t);
-}
-
-static APR_INLINE
-apr_status_t apreq_args(apreq_handle_t *env, const apr_table_t **t)
-{
-    return env->module->args(env,t);
-}
-
-static APR_INLINE
-apr_status_t apreq_body(apreq_handle_t *env, const apr_table_t **t)
-{
-    return env->module->body(env,t);
-}
-
-static APR_INLINE
-apreq_cookie_t *apreq_jar_get(apreq_handle_t *env, const char *name)
-{
-    return env->module->jar_get(env, name);
-}
-
-static APR_INLINE
-apreq_param_t *apreq_args_get(apreq_handle_t *env, const char *name)
-{
-    return env->module->args_get(env, name);
-}
-
-static APR_INLINE
-apreq_param_t *apreq_body_get(apreq_handle_t *env, const char *name)
-{
-    return env->module->body_get(env, name);
-}
-
-static APR_INLINE
-apr_status_t apreq_parser_get(apreq_handle_t *env,
-                              const apreq_parser_t **parser)
-{
-    return env->module->parser_get(env, parser);
-}
-
-static APR_INLINE
-apr_status_t apreq_parser_set(apreq_handle_t *env,
-                              apreq_parser_t *parser)
-{
-    return env->module->parser_set(env, parser);
-}
-
-static APR_INLINE
-apr_status_t apreq_hook_add(apreq_handle_t *env, apreq_hook_t *hook)
-{
-    return env->module->hook_add(env, hook);
-}
-
-static APR_INLINE
-const char *apreq_header_in(apreq_handle_t *env, const char *name)
-{
-    return env->module->header_in(env, name);
-}
-
-static APR_INLINE
-apr_status_t apreq_header_out(apreq_handle_t *env,
-                              const char *name, char *val)
-{
-    return env->module->header_out(env, name, val);
-}
-
-static APR_INLINE
-apr_status_t apreq_brigade_limit_set(apreq_handle_t *env,
-                                     apr_size_t bytes)
-{
-    return env->module->brigade_limit_set(env, bytes);
-}
-
-static APR_INLINE
-apr_status_t apreq_brigade_limit_get(apreq_handle_t *env,
-                                     apr_size_t *bytes)
-{
-    return env->module->brigade_limit_get(env, bytes);
-}
-
-static APR_INLINE
-apr_status_t apreq_read_limit_set(apreq_handle_t *env,
-                                  apr_uint64_t bytes)
-{
-    return env->module->read_limit_set(env, bytes);
-}
-
-static APR_INLINE
-apr_status_t apreq_read_limit_get(apreq_handle_t *env,
-                                  apr_uint64_t *bytes)
-{
-    return env->module->read_limit_get(env, bytes);
-}
-
-static APR_INLINE
-apr_status_t apreq_temp_dir_set(apreq_handle_t *env, const char *path)
-{
-    return env->module->temp_dir_set(env, path);
-}
-
-static APR_INLINE
-apr_status_t apreq_temp_dir_get(apreq_handle_t *env, const char **path)
-{
-    return env->module->temp_dir_get(env, path);
-}
-
-
-
-
-
-
-/**
- * @file apreq_env.h
- * @brief Logging and environment (module) declarations.
- * @ingroup libapreq2
- */
-
-
-/**
- * Fetch the header value (joined by ", " if there are multiple headers)
- * for a given header name.
- * @param env The current environment.
- * @param name The header name.
- * @return The value of the header, NULL if not found.
- */
-
-
-/**
- * Add a header field to the environment's outgoing response headers
- * @param env The current environment.
- * @param name The name of the outgoing header.
- * @param val Value of the outgoing header.
- * @return APR_SUCCESS on success, error code otherwise.
- */
-
-
-/**
- * Convenience macro for defining an environment module by mapping
- * a function prefix to an associated environment structure.
- * @param pre Prefix to define new environment.  All attributes of
- * the apreq_env_module_t struct are defined with this as their prefix. The
- * generated struct is named by appending "_module" to the prefix.
- * @param name Name of this environment.
- * @param mmn Magic number (i.e. version number) of this environment.
- */
-#define APREQ_MODULE(pre, mmn) const apreq_module_t     \
-  pre##_module = { #pre, mmn,                           \
-  pre##_jar,        pre##_args,       pre##_body,       \
-  pre##_jar_get,    pre##_args_get,   pre##_body_get,   \
-  pre##_parser_get, pre##_parser_set, pre##_hook_add,   \
-  pre##_brigade_limit_get, pre##_brigade_limit_set,     \
-  pre##_read_limit_get,    pre##_read_limit_set,        \
-  pre##_temp_dir_get,      pre##_temp_dir_set,          \
-  pre##_header_in,         pre##_header_out }
-
-/**
- * Create an apreq handle which is suitable for a CGI program. It
- * reads input from stdin and writes output to stdout.
- */
-APREQ_DECLARE(apreq_handle_t*) apreq_handle_cgi(apr_pool_t *pool);
-
-/**
- * Create a custom apreq handle which knows only some static
- * values. Useful if you want to test the parser code or if you have
- * got data from a custom source (neither Apache 2 nor CGI).
- * @param pool the APR pool
- * @param query_string the query string
- * @param cookie value of the request "Cookie" header
- * @param cookie2 value of the request "Cookie2" header
- * @param content_type content type of the request body
- * @param in a bucket brigade containing the request body
- */
-APREQ_DECLARE(apreq_handle_t*) apreq_handle_custom(apr_pool_t *pool,
-                                                       const char 
*query_string,
-                                                       const char *cookie,
-                                                       const char *cookie2,
-                                                       apreq_parser_t *parser,
-                                                       apr_uint64_t read_limit,
-                                                       apr_bucket_brigade *in);
-
-/**
- * Add the cookie to the outgoing "Set-Cookie" headers.
+#ifndef WIN32
+#define APREQ_DECLARE(d)                APR_DECLARE(d)
+#define APREQ_DECLARE_NONSTD(d)         APR_DECLARE_NONSTD(d)
+#define APREQ_DECLARE_DATA
+#else
+#define APREQ_DECLARE(type)             __declspec(dllexport) type __stdcall
+#define APREQ_DECLARE_NONSTD(type)      __declspec(dllexport) type
+#define APREQ_DECLARE_DATA              __declspec(dllexport)
+#endif
+
+#define APREQ_DEFAULT_READ_BLOCK_SIZE   (64  * 1024)
+#define APREQ_DEFAULT_READ_LIMIT        (64 * 1024 * 1024)
+#define APREQ_DEFAULT_BRIGADE_LIMIT     (256 * 1024)
+#define APREQ_DEFAULT_NELTS              8
+
+
+
+#define APREQ_FLAGS_OFF(f, name) ((f) &= ~(name##_MASK << name##_BIT))
+#define APREQ_FLAGS_ON(f, name)  ((f) |=  (name##_MASK << name##_BIT))
+#define APREQ_FLAGS_GET(f, name) (((f) >> name##_BIT) & name##_MASK)
+#define APREQ_FLAGS_SET(f, name, value)                 \
+    ((f) = (((f) & ~(name##_MASK << name##_BIT))        \
+            | ((name##_MASK & (value)) << name##_BIT)))
+
+
+#define APREQ_CHARSET_BIT           0
+#define APREQ_CHARSET_MASK        255
+
+#define APREQ_TAINT_BIT             8
+#define APREQ_TAINT_MASK            1
+
+#define APREQ_COOKIE_VERSION_BIT   11
+#define APREQ_COOKIE_VERSION_MASK   3
+
+#define APREQ_COOKIE_SECURE_BIT    13
+#define APREQ_COOKIE_SECURE_MASK    1
+
+
+/** @enum apreq_join_t Join type */
+typedef enum { 
+    APREQ_JOIN_AS_IS,      /**< Join the strings without modification */
+    APREQ_JOIN_ENCODE,     /**< Url-encode the strings before joining them */
+    APREQ_JOIN_DECODE,     /**< Url-decode the strings before joining them */
+    APREQ_JOIN_QUOTE       /**< Quote the strings, backslashing existing quote 
marks. */
+} apreq_join_t;
+
+/** @enum apreq_match_t Match type */
+typedef enum {
+    APREQ_MATCH_FULL,       /**< Full match only. */
+    APREQ_MATCH_PARTIAL     /**< Partial matches are ok. */
+} apreq_match_t;
+
+/** @enum apreq_expires_t Expiration date format */
+typedef enum {
+    APREQ_EXPIRES_HTTP,       /**< Use date formatting consistent with RFC 
2616 */
+    APREQ_EXPIRES_NSCOOKIE    /**< Use format consistent with Netscape's 
Cookie Spec */
+} apreq_expires_t;
+
+
+/** @brief libapreq's pre-extensible string type */
+typedef struct apreq_value_t {
+    char             *name;    /**< value name */
+    apr_size_t        size;    /**< value length (in bytes) */
+    char              data[1]; /**< value data  */
+} apreq_value_t;
+
+#define apreq_attr_to_type(T,A,P) ( (T*) ((char*)(P)-offsetof(T,A)) )
+
+/**
+ * Initialize libapreq2. Applications (except apache modules using
+ * mod_apreq) have to call this exactly once before they use
+ * libapreq2.
  *
- * @param c The cookie.
- * @param env Environment.
+ * @param pool a base pool persisting while libapreq2 is used
+ * @remark after you detroyed the pool, you have to call this function again
+ *    with a new pool if you still plan to use libapreq2
  */
-APREQ_DECLARE(apr_status_t) apreq_cookie_bake(const apreq_cookie_t *c,
-                                              apreq_handle_t *env);
-
-/**
- * Add the cookie to the outgoing "Set-Cookie2" headers.
- *
- * @param c The cookie.
- * @param env Environment.
- */
-APREQ_DECLARE(apr_status_t) apreq_cookie_bake2(const apreq_cookie_t *c,
-                                               apreq_handle_t *env);
-
-/**
- * Looks for the presence of a "Cookie2" header to determine whether
- * or not the current User-Agent supports rfc2965.
- * @param env The current environment.
- * @return APREQ_COOKIE_VERSION_RFC if rfc2965 is supported, 
- *         APREQ_COOKIE_VERSION_NETSCAPE otherwise.
- */
-APREQ_DECLARE(apreq_cookie_version_t)
-    apreq_ua_cookie_version(apreq_handle_t *env);
-
-
-APREQ_DECLARE(apreq_param_t *)apreq_param(apreq_handle_t *env, 
-                                          const char *name);
-
-#define apreq_cookie(env, name) apreq_jar_get(env, name)
-
-/**
- * Returns a table containing key-value pairs for the full request
- * (args + body).
- * @param p Allocates the returned table.
- * @param req The current apreq_request_t object.
- * @remark Also parses the request if necessary.
- */
-APREQ_DECLARE(apr_table_t *) apreq_params(apr_pool_t *p,
-                                          apreq_handle_t *env);
-
-
-APREQ_DECLARE(apr_table_t *)apreq_cookies(apr_pool_t *p,
-                                          apreq_handle_t *env);
-
-/**
- * Force a complete parse.
- * @param req Current request handle.
- * @return APR_SUCCESS on an error-free parse of the request data.
- *         Any other status code indicates a problem somewhere.
- *
- */
-
-static APR_INLINE
-apr_status_t apreq_parse(apreq_handle_t *req)
-{
-    const apr_table_t *dummy;
-    apr_status_t jar_status, args_status, body_status;
-
-    jar_status = apreq_jar(req, &dummy);
-    args_status = apreq_args(req, &dummy);
-    body_status = apreq_body(req, &dummy);
-
-    /* XXX: punt to APR_EGENERAL; need to improve this
-     * for valid requests where certain data/headers are 
-     * unavailable.
-     */
-    if (jar_status || args_status || body_status)
-        return APR_EGENERAL;
-
-    return APR_SUCCESS;
-}
-
-
-
+APREQ_DECLARE(apr_status_t) apreq_initialize(apr_pool_t *pool);
 
 #ifdef __cplusplus
  }

Modified: httpd/apreq/branches/multi-env-unstable/include/apreq_cookie.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/include/apreq_cookie.h?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_cookie.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_cookie.h Fri Feb 18 
14:07:36 2005
@@ -17,8 +17,8 @@
 #ifndef APREQ_COOKIE_H
 #define APREQ_COOKIE_H
 
-#include "apreq_util.h"
-#include "apr_tables.h"
+#include "apreq.h"
+#include "apr_time.h"
 
 #ifdef  __cplusplus
 extern "C" {
@@ -40,45 +40,27 @@
  *
  */
 
-
-/**
- * Cookie Version.  libapreq does not distinguish between
- * rfc2109 and its successor rfc2965; both are referred to
- * as APREQ_COOKIE_VERSION_RFC.  Users can distinguish between
- * them in their outgoing cookies by using apreq_cookie_bake()
- * for sending rfc2109 cookies, or apreq_cookie_bake2() for rfc2965.
- * The original Netscape cookie spec is still preferred for its
- * greater portability, it is named APREQ_COOKIE_VERSION_NETSCAPE.
- *
- */
-typedef enum { APREQ_COOKIE_VERSION_NETSCAPE, 
-               APREQ_COOKIE_VERSION_RFC } apreq_cookie_version_t;
-
-
-/** Default version, used when creating a new cookie. See 
apreq_cookie_make().*/
-#define APREQ_COOKIE_VERSION_DEFAULT       APREQ_COOKIE_VERSION_NETSCAPE
-
-/** Maximum length of a single Set-Cookie(2) header */
+/** XXX: move this to apreq_module_t ...
+    Maximum length of a single Set-Cookie(2) header */
 #define APREQ_COOKIE_MAX_LENGTH            4096
 
 /** @brief Cookie type, supporting both Netscape and RFC cookie specifications.
  */
-typedef struct apreq_cookie_t {
 
-    apreq_cookie_version_t version; /**< RFC or Netscape compliant cookie */
+typedef struct apreq_cookie_t {
 
     char           *path;        /**< Restricts url path */
     char           *domain;      /**< Restricts server domain */
     char           *port;        /**< Restricts server port */
-    unsigned        secure;      /**< Notify browser of "https" requirement */
     char           *comment;     /**< RFC cookies may send a comment */
     char           *commentURL;  /**< RFC cookies may place an URL here */
     apr_time_t      max_age;     /**< total duration of cookie: -1 == session 
*/
-    unsigned char   flags;       /**< charsets, taint marks, app-specific bits 
*/
+    unsigned        flags;       /**< charsets, taint marks, app-specific bits 
*/
     const apreq_value_t   v;     /**< "raw" cookie value */
 
 } apreq_cookie_t;
 
+
 /** Upgrades cookie jar table values to apreq_cookie_t structs. */
 static APR_INLINE
 apreq_cookie_t *apreq_value_to_cookie(const char *val)
@@ -91,14 +73,63 @@
 }
 
 static APR_INLINE
-const char *apreq_cookie_name(const apreq_cookie_t *c) {
-    return c->v.name;
+const char *apreq_cookie_name(const apreq_cookie_t *c) { return c->v.name; }
+
+static APR_INLINE
+const char *apreq_cookie_value(const apreq_cookie_t *c) { return c->v.data; }
+
+
+/[EMAIL PROTECTED] 1 if this is an RFC cookie, 0 if its a Netscape cookie. */
+static APR_INLINE
+unsigned apreq_cookie_version(const apreq_cookie_t *c) {
+    return APREQ_FLAGS_GET(c->flags, APREQ_COOKIE_VERSION);
+}
+
+/** Sets the cookie's protocol version. */
+static APR_INLINE
+void apreq_cookie_version_set(apreq_cookie_t *c, unsigned v) {
+    APREQ_FLAGS_SET(c->flags, APREQ_COOKIE_VERSION, v);
 }
 
+/** @return 1 if the secure flag is set, 0 otherwise. */
 static APR_INLINE
-const char *apreq_cookie_value(const apreq_cookie_t *c) {
-    return c->v.data;
+unsigned apreq_cookie_is_secure(const apreq_cookie_t *c) {
+    return APREQ_FLAGS_GET(c->flags, APREQ_COOKIE_SECURE);
 }
+
+/** Sets the cookie's secure flag, meaning it only
+ *  comes back over an SSL-encrypted connction.
+ */
+static APR_INLINE
+void apreq_cookie_secure_on(apreq_cookie_t *c) {
+    APREQ_FLAGS_ON(c->flags, APREQ_COOKIE_SECURE);
+}
+
+/** Turns off the cookie's secure flag. */
+static APR_INLINE
+void apreq_cookie_secure_off(apreq_cookie_t *c) {
+    APREQ_FLAGS_OFF(c->flags, APREQ_COOKIE_SECURE);
+}
+
+
+/** @return 1 if the taint flag is set, 0 otherwise. */
+static APR_INLINE
+unsigned apreq_cookie_is_tainted(const apreq_cookie_t *c) {
+    return APREQ_FLAGS_GET(c->flags, APREQ_TAINT);
+}
+
+/** Sets the cookie's tainted flag. */
+static APR_INLINE
+void apreq_cookie_taint_on(apreq_cookie_t *c) {
+    APREQ_FLAGS_ON(c->flags, APREQ_TAINT);
+}
+
+/** Turns off the cookie's taint flag. */
+static APR_INLINE
+void apreq_cookie_taint_off(apreq_cookie_t *c) {
+    APREQ_FLAGS_OFF(c->flags, APREQ_TAINT);
+}
+
 
 APREQ_DECLARE(apr_status_t)apreq_parse_cookie_header(apr_pool_t *pool,
                                                      apr_table_t *jar,

Added: httpd/apreq/branches/multi-env-unstable/include/apreq_error.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/include/apreq_error.h?view=auto&rev=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_error.h (added)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_error.h Fri Feb 18 
14:07:36 2005
@@ -0,0 +1,87 @@
+/*
+**  Copyright 2003-2004  The Apache Software Foundation
+**
+**  Licensed under the Apache License, Version 2.0 (the "License");
+**  you may not use this file except in compliance with the License.
+**  You may obtain a copy of the License at
+**
+**      http://www.apache.org/licenses/LICENSE-2.0
+**
+**  Unless required by applicable law or agreed to in writing, software
+**  distributed under the License is distributed on an "AS IS" BASIS,
+**  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+**  See the License for the specific language governing permissions and
+**  limitations under the License.
+*/
+
+#ifndef APREQ_ERROR_H
+#define APREQ_ERROR_H
+
+#include "apr_errno.h"
+#include "apreq.h"
+
+#ifdef  __cplusplus
+ extern "C" {
+#endif 
+
+APREQ_DECLARE(char *)
+apreq_strerror(apr_status_t s, char *buf, apr_size_t bufsize);
+
+/**
+ * Beginning work on error-codes ...
+ *
+ *
+ */
+#ifndef APR_EBADARG
+#define APR_EBADARG                APR_BADARG   /* XXX: don't use APR_BADARG */
+#endif
+
+/* 0's: generic error status codes */
+#define APREQ_ERROR_GENERAL        APR_OS_START_USERERR
+#define APREQ_ERROR_INTERRUPT      APREQ_ERROR_GENERAL + 1
+
+/* 10's: malformed input */
+#define APREQ_ERROR_NODATA         APREQ_ERROR_GENERAL + 10
+#define APREQ_ERROR_BADSEQ         APREQ_ERROR_GENERAL + 11
+#define APREQ_ERROR_BADCHAR        APREQ_ERROR_GENERAL + 12
+#define APREQ_ERROR_BADTOKEN       APREQ_ERROR_GENERAL + 13
+#define APREQ_ERROR_NOTOKEN        APREQ_ERROR_GENERAL + 14
+#define APREQ_ERROR_BADATTR        APREQ_ERROR_GENERAL + 15
+#define APREQ_ERROR_BADHEADER      APREQ_ERROR_GENERAL + 16
+#define APREQ_ERROR_NOHEADER       APREQ_ERROR_GENERAL + 17
+
+/* 20's: misconfiguration */
+#define APREQ_ERROR_CONFLICT       APREQ_ERROR_GENERAL + 20 /*XXX this sucks*/
+#define APREQ_ERROR_NOPARSER       APREQ_ERROR_GENERAL + 21
+#define APREQ_ERROR_TAINTED        APREQ_ERROR_GENERAL + 22
+
+
+/* 30's: limit violations */
+#define APREQ_ERROR_OVERLIMIT      APREQ_ERROR_GENERAL + 30
+#define APREQ_ERROR_UNDERLIMIT     APREQ_ERROR_GENERAL + 31
+
+/* unsafe output */
+
+
+static APR_INLINE
+unsigned char apreq_status_is_error(apr_status_t s) {
+    switch (s) {
+    case APR_SUCCESS:
+    case APR_INCOMPLETE:
+    case APR_EINIT:
+    case APREQ_ERROR_NODATA:
+
+        return 0;
+    default:
+        return 1;
+    }
+}
+
+
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* APREQ_ERROR_H */

Added: httpd/apreq/branches/multi-env-unstable/include/apreq_module.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/include/apreq_module.h?view=auto&rev=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_module.h (added)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_module.h Fri Feb 18 
14:07:36 2005
@@ -0,0 +1,391 @@
+/*
+**  Copyright 2003-2004  The Apache Software Foundation
+**
+**  Licensed under the Apache License, Version 2.0 (the "License");
+**  you may not use this file except in compliance with the License.
+**  You may obtain a copy of the License at
+**
+**      http://www.apache.org/licenses/LICENSE-2.0
+**
+**  Unless required by applicable law or agreed to in writing, software
+**  distributed under the License is distributed on an "AS IS" BASIS,
+**  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+**  See the License for the specific language governing permissions and
+**  limitations under the License.
+*/
+
+#ifndef APREQ_MODULE_H
+#define APREQ_MODULE_H
+
+#include "apreq_cookie.h"
+#include "apreq_parser.h"
+
+#ifdef  __cplusplus
+ extern "C" {
+#endif 
+
+/**
+ * An apreq handle associated with a module. The structure
+ * may have variable size, because the module may append its own data
+ * structures after it.
+ */
+typedef struct apreq_handle_t {
+    const struct apreq_module_t *module;
+} apreq_handle_t;
+
+/**
+ * @brief Vtable describing the necessary environment functions.
+ */
+
+
+typedef struct apreq_module_t {
+    const char *name;
+    apr_uint32_t magic_number;
+
+    apr_status_t (*jar)(apreq_handle_t *, const apr_table_t **);
+    apr_status_t (*args)(apreq_handle_t *, const apr_table_t **);
+    apr_status_t (*body)(apreq_handle_t *, const apr_table_t **);
+
+    apreq_cookie_t *(*jar_get)(apreq_handle_t *, const char *);
+    apreq_param_t *(*args_get)(apreq_handle_t *, const char *);
+    apreq_param_t *(*body_get)(apreq_handle_t *, const char *);
+
+    apr_status_t (*parser_get)(apreq_handle_t *, const apreq_parser_t **);
+    apr_status_t (*parser_set)(apreq_handle_t *, apreq_parser_t *);
+    apr_status_t (*hook_add)(apreq_handle_t *, apreq_hook_t *);
+
+    apr_status_t (*brigade_limit_get)(apreq_handle_t *, apr_size_t *);
+    apr_status_t (*brigade_limit_set)(apreq_handle_t *, apr_size_t);
+
+    apr_status_t (*read_limit_get)(apreq_handle_t *, apr_uint64_t *);
+    apr_status_t (*read_limit_set)(apreq_handle_t *, apr_uint64_t);
+
+    apr_status_t (*temp_dir_get)(apreq_handle_t *, const char **);
+    apr_status_t (*temp_dir_set)(apreq_handle_t *, const char *);
+
+    const char *(*header_in)(apreq_handle_t *,const char *);
+    apr_status_t (*header_out)(apreq_handle_t *, const char *,char *);
+
+} apreq_module_t;
+
+
+/**
+ * Expose the parsed "cookie" header associated to this handle. 
+ * @req
+ * @arg t  The resulting table, or which may point to NULL 
+ *          when the return value is not APR_SUCCESS. Otherwise 
+ *         it must point to a valid table object.
+ * @return APR_SUCCESS on success.
+ * @return APREQ_ERROR_NODATA if no "Cookie" header data is available.
+ */
+static APR_INLINE
+apr_status_t apreq_jar(apreq_handle_t *req, const apr_table_t **t)
+{
+    return req->module->jar(req,t);
+}
+
+/**
+ * Expose the parsed "query string" associated to this handle. 
+ * @req
+ * @arg t  The resulting table, or which may point to NULL 
+ *          when the return value is not APR_SUCCESS. Otherwise 
+ *         it must point to a valid table object.
+ * @return APR_SUCCESS on success.
+ * @return APREQ_ERROR_NODATA if no query string is available.
+ */
+static APR_INLINE
+apr_status_t apreq_args(apreq_handle_t *req, const apr_table_t **t)
+{
+    return req->module->args(req,t);
+}
+
+/**
+ * Expose the parsed "request body" associated to this handle. 
+ * @req
+ * @arg t  The resulting table, or which may point to NULL 
+ *          when the return value is not APR_SUCCESS. Otherwise 
+ *         it must point to a valid table object.
+ * @return APR_SUCCESS on success.
+ * @return APREQ_ERROR_NODATA if no request content is available.
+ */
+static APR_INLINE
+apr_status_t apreq_body(apreq_handle_t *req, const apr_table_t **t)
+{
+    return req->module->body(req, t);
+}
+
+
+/**
+ * Fetch the first cookie with the given name. 
+ * @req
+ * @arg name Case-insensitive cookie name.
+ * @return Desired cookie, or NULL if none match.
+ */
+static APR_INLINE
+apreq_cookie_t *apreq_jar_get(apreq_handle_t *req, const char *name)
+{
+    return req->module->jar_get(req, name);
+}
+
+/**
+ * Fetch the first query string param with the given name. 
+ * @req
+ * @arg name Case-insensitive param name.
+ * @return Desired param, or NULL if none match.
+ */
+static APR_INLINE
+apreq_param_t *apreq_args_get(apreq_handle_t *req, const char *name)
+{
+    return req->module->args_get(req, name);
+}
+
+/**
+ * Fetch the first cookie with the given name. 
+ * @req
+ * @arg name Case-insensitive cookie name.
+ * @return Desired cookie, or NULL if none match.
+ */
+static APR_INLINE
+apreq_param_t *apreq_body_get(apreq_handle_t *req, const char *name)
+{
+    return req->module->body_get(req, name);
+}
+
+/**
+ * Fetch the active body parser.
+ * @req
+ * @arg parser Points to the active parser on return.
+ * @return Parser's current status.  Use apreq_body
+ * if you need its final status (the return values
+ * will be identical once the parser has finished).
+ *
+ */
+static APR_INLINE
+apr_status_t apreq_parser_get(apreq_handle_t *req,
+                              const apreq_parser_t **parser)
+{
+    return req->module->parser_get(req, parser);
+}
+
+
+/**
+ * Set the body parser for this request.
+ * @req
+ * @arg parser New parser to use.
+ * @return APR_SUCCESS if the action was succesful, error otherwise.
+ */
+static APR_INLINE
+apr_status_t apreq_parser_set(apreq_handle_t *req,
+                              apreq_parser_t *parser)
+{
+    return req->module->parser_set(req, parser);
+}
+
+/**
+ * Add a parser hook for this request.
+ * @req
+ * @arg hook Hook to add.
+ * @return APR_SUCCESS if the action was succesful, error otherwise.
+ */
+static APR_INLINE
+apr_status_t apreq_hook_add(apreq_handle_t *req, apreq_hook_t *hook)
+{
+    return req->module->hook_add(req, hook);
+}
+
+
+/**
+ * Fetch the header value (joined by ", " if there are multiple headers)
+ * for a given header name.
+ * @req
+ * @param name The header name.
+ * @return The value of the header, NULL if not found.
+ */
+static APR_INLINE
+const char *apreq_header_in(apreq_handle_t *req, const char *name)
+{
+    return req->module->header_in(req, name);
+}
+
+
+/**
+ * Add a header field to the environment's outgoing response headers
+ * @req.
+ * @param name The name of the outgoing header.
+ * @param val Value of the outgoing header.
+ * @return APR_SUCCESS on success, error code otherwise.
+ */
+
+static APR_INLINE
+apr_status_t apreq_header_out(apreq_handle_t *req,
+                              const char *name, char *val)
+{
+    return req->module->header_out(req, name, val);
+}
+
+
+static APR_INLINE
+apr_status_t apreq_brigade_limit_set(apreq_handle_t *req,
+                                     apr_size_t bytes)
+{
+    return req->module->brigade_limit_set(req, bytes);
+}
+
+static APR_INLINE
+apr_status_t apreq_brigade_limit_get(apreq_handle_t *req,
+                                     apr_size_t *bytes)
+{
+    return req->module->brigade_limit_get(req, bytes);
+}
+
+static APR_INLINE
+apr_status_t apreq_read_limit_set(apreq_handle_t *req,
+                                  apr_uint64_t bytes)
+{
+    return req->module->read_limit_set(req, bytes);
+}
+
+static APR_INLINE
+apr_status_t apreq_read_limit_get(apreq_handle_t *req,
+                                  apr_uint64_t *bytes)
+{
+    return req->module->read_limit_get(req, bytes);
+}
+
+static APR_INLINE
+apr_status_t apreq_temp_dir_set(apreq_handle_t *req, const char *path)
+{
+    return req->module->temp_dir_set(req, path);
+}
+
+static APR_INLINE
+apr_status_t apreq_temp_dir_get(apreq_handle_t *req, const char **path)
+{
+    return req->module->temp_dir_get(req, path);
+}
+
+
+
+/**
+ * Convenience macro for defining a module by mapping
+ * a function prefix to an associated apreq_module_t structure.
+ * @param pre Prefix to define new environment.  All attributes of
+ * the apreq_env_module_t struct are defined with this as their prefix. The
+ * generated struct is named by appending "_module" to the prefix.
+ * @param name Name of this environment.
+ * @param mmn Magic number (i.e. version number) of this environment.
+ */
+#define APREQ_MODULE(pre, mmn) const apreq_module_t     \
+  pre##_module = { #pre, mmn,                           \
+  pre##_jar,        pre##_args,       pre##_body,       \
+  pre##_jar_get,    pre##_args_get,   pre##_body_get,   \
+  pre##_parser_get, pre##_parser_set, pre##_hook_add,   \
+  pre##_brigade_limit_get, pre##_brigade_limit_set,     \
+  pre##_read_limit_get,    pre##_read_limit_set,        \
+  pre##_temp_dir_get,      pre##_temp_dir_set,          \
+  pre##_header_in,         pre##_header_out }
+
+/**
+ * Create an apreq handle which is suitable for a CGI program. It
+ * reads input from stdin and writes output to stdout.
+ */
+APREQ_DECLARE(apreq_handle_t*) apreq_handle_cgi(apr_pool_t *pool);
+
+/**
+ * Create a custom apreq handle which knows only some static
+ * values. Useful if you want to test the parser code or if you have
+ * got data from a custom source (neither Apache 2 nor CGI).
+ * @param pool the APR pool
+ * @param query_string the query string
+ * @param cookie value of the request "Cookie" header
+ * @param cookie2 value of the request "Cookie2" header
+ * @param parser parser for handling the request body
+ * @param in a bucket brigade containing the request body
+ */
+APREQ_DECLARE(apreq_handle_t*) apreq_handle_custom(apr_pool_t *pool,
+                                                   const char *query_string,
+                                                   const char *cookie,
+                                                   const char *cookie2,
+                                                   apreq_parser_t *parser,
+                                                   apr_uint64_t read_limit,
+                                                   apr_bucket_brigade *in);
+
+/**
+ * Add the cookie to the outgoing "Set-Cookie" headers.
+ *
+ * @param c The cookie.
+ * @req
+ */
+APREQ_DECLARE(apr_status_t) apreq_cookie_bake(const apreq_cookie_t *c,
+                                              apreq_handle_t *req);
+
+/**
+ * Add the cookie to the outgoing "Set-Cookie2" headers.
+ *
+ * @param c The cookie.
+ */
+APREQ_DECLARE(apr_status_t) apreq_cookie_bake2(const apreq_cookie_t *c,
+                                               apreq_handle_t *req);
+
+/**
+ * Looks for the presence of a "Cookie2" header to determine whether
+ * or not the current User-Agent supports rfc2965.
+ * @req
+ * @return APREQ_COOKIE_VERSION_RFC if rfc2965 is supported, 
+ *         APREQ_COOKIE_VERSION_NETSCAPE otherwise.
+ */
+APREQ_DECLARE(unsigned)apreq_ua_cookie_version(apreq_handle_t *req);
+
+
+APREQ_DECLARE(apreq_param_t *)apreq_param(apreq_handle_t *env, 
+                                          const char *name);
+
+#define apreq_cookie(req, name) apreq_jar_get(req, name)
+
+/**
+ * Returns a table containing key-value pairs for the full request
+ * (args + body).
+ * @param p Allocates the returned table.
+ * @req
+ * @remark Also parses the request if necessary.
+ */
+APREQ_DECLARE(apr_table_t *) apreq_params(apr_pool_t *p,
+                                          apreq_handle_t *req);
+
+
+APREQ_DECLARE(apr_table_t *)apreq_cookies(apr_pool_t *p,
+                                          apreq_handle_t *req);
+
+/**
+ * Force a complete parse.
+ * @req
+ * @return APR_SUCCESS on an error-free parse of the request data.
+ *         Any other status code indicates a problem somewhere.
+ *
+ */
+
+static APR_INLINE
+apr_status_t apreq_parse(apreq_handle_t *req)
+{
+    const apr_table_t *dummy;
+    apr_status_t jar_status, args_status, body_status;
+
+    jar_status = apreq_jar(req, &dummy);
+    args_status = apreq_args(req, &dummy);
+    body_status = apreq_body(req, &dummy);
+
+    /* XXX: punt to APR_EGENERAL; need to improve this
+     * for valid requests where certain data/headers are 
+     * unavailable.
+     */
+    if (jar_status || args_status || body_status)
+        return APR_EGENERAL;
+
+    return APR_SUCCESS;
+}
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* APREQ_MODULE_H */

Modified: httpd/apreq/branches/multi-env-unstable/include/apreq_param.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/include/apreq_param.h?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_param.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_param.h Fri Feb 18 
14:07:36 2005
@@ -17,7 +17,8 @@
 #ifndef APREQ_PARAM_H
 #define APREQ_PARAM_H
 
-#include "apreq_util.h"
+#include "apreq.h"
+#include "apr_buckets.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -35,53 +36,50 @@
 typedef struct apreq_param_t {
     apr_table_t         *info;   /**< header table associated with the param */
     apr_bucket_brigade  *upload; /**< brigade used to spool upload files */
-    unsigned char        flags;  /**< charsets, taint marks, app-specific bits 
*/
+    unsigned             flags;  /**< charsets, taint marks, app-specific bits 
*/
     const apreq_value_t  v;      /**< underlying name/value/status info */
 } apreq_param_t;
 
-
-/** Upgrades args and body table values to apreq_param_t structs. */
 static APR_INLINE
-apreq_param_t *apreq_value_to_param(const char *val)
-{
-    union { const char *in; char *out; } deconst;
+const char *apreq_param_name(const apreq_param_t *p) { return p->v.name; }
 
-    deconst.in = val;
-    return apreq_attr_to_type(apreq_param_t, v, 
-           apreq_attr_to_type(apreq_value_t, data, deconst.out));
-}
+static APR_INLINE
+const char *apreq_param_value(const apreq_param_t *p) { return p->v.data; }
 
 
+/** @return 1 if the taint flag is set, 0 otherwise. */
 static APR_INLINE
-const char *apreq_param_name(const apreq_param_t *p) {
-    return p->v.name;
+unsigned apreq_param_is_tainted(const apreq_param_t *p) {
+    return APREQ_FLAGS_GET(p->flags, APREQ_TAINT);
 }
 
+/** Sets the tainted flag. */
 static APR_INLINE
-const char *apreq_param_value(const apreq_param_t *p) {
-    return p->v.data;
+void apreq_param_taint_on(apreq_param_t *p) {
+    APREQ_FLAGS_ON(p->flags, APREQ_TAINT);
 }
 
+/** Turns off the taint flag. */
 static APR_INLINE
-const apr_table_t *apreq_param_info(const apreq_param_t *p) {
-    return p->info;
+void apreq_param_taint_off(apreq_param_t *p) {
+    APREQ_FLAGS_OFF(p->flags, APREQ_TAINT);
 }
 
-static APR_INLINE
-apr_bucket_brigade *apreq_param_brigade(const apreq_param_t *p) {
-    apr_bucket_brigade *bb;
 
-    if (p->upload == NULL)
-        return NULL;
-
-    bb = apr_brigade_create(p->upload->p, p->upload->bucket_alloc);
-    apreq_brigade_copy(bb, p->upload);
+/** Upgrades args and body table values to apreq_param_t structs. */
+static APR_INLINE
+apreq_param_t *apreq_value_to_param(const char *val)
+{
+    union { const char *in; char *out; } deconst;
 
-    return bb;
+    deconst.in = val;
+    return apreq_attr_to_type(apreq_param_t, v, 
+           apreq_attr_to_type(apreq_value_t, data, deconst.out));
 }
 
+
 /** creates a param from name/value information */
-APREQ_DECLARE(apreq_param_t *) apreq_make_param(apr_pool_t *p, 
+APREQ_DECLARE(apreq_param_t *) apreq_param_make(apr_pool_t *p, 
                                                 const char *name, 
                                                 const apr_size_t nlen, 
                                                 const char *val, 
@@ -97,7 +95,7 @@
  *              exactly one character ('=') which separates the pair.
  *            
  */
-APREQ_DECLARE(apr_status_t) apreq_decode_param(apreq_param_t **param,
+APREQ_DECLARE(apr_status_t) apreq_param_decode(apreq_param_t **param,
                                                apr_pool_t *pool, 
                                                const char *word,
                                                const apr_size_t nlen, 
@@ -109,7 +107,7 @@
  * @return name-value pair representing the param.
  */
 
-APREQ_DECLARE(char *) apreq_encode_param(apr_pool_t *pool, 
+APREQ_DECLARE(char *) apreq_param_encode(apr_pool_t *pool, 
                                          const apreq_param_t *param);
 
 /**

Modified: httpd/apreq/branches/multi-env-unstable/include/apreq_parser.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/include/apreq_parser.h?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_parser.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_parser.h Fri Feb 18 
14:07:36 2005
@@ -92,7 +92,7 @@
  * public status: APR_INCOMPLETE, APR_SUCCESS, or an error code.
  */
 static APR_INLINE
-apr_status_t apreq_run_parser(struct apreq_parser_t *psr, apr_table_t *t,
+apr_status_t apreq_parser_run(struct apreq_parser_t *psr, apr_table_t *t,
                               apr_bucket_brigade *bb) {
     return psr->parser(psr, t, bb);
 }
@@ -105,7 +105,7 @@
  * @return APR_SUCCESS on success. All other values represent errors.
  */
 static APR_INLINE
-apr_status_t apreq_run_hook(struct apreq_hook_t *h, apreq_param_t *param,
+apr_status_t apreq_hook_run(struct apreq_hook_t *h, apreq_param_t *param,
                             apr_bucket_brigade *bb) {
     return h->hook(h, param, bb);
 }
@@ -161,7 +161,7 @@
  * @return New parser.
  */
 APREQ_DECLARE(apreq_parser_t *)
-        apreq_make_parser(apr_pool_t *pool,
+        apreq_parser_make(apr_pool_t *pool,
                           apr_bucket_alloc_t *bucket_alloc,
                           const char *content_type,
                           apreq_parser_function_t parser,
@@ -180,7 +180,7 @@
  * @return New hook.
  */
 APREQ_DECLARE(apreq_hook_t *)
-        apreq_make_hook(apr_pool_t *pool,
+        apreq_hook_make(apr_pool_t *pool,
                         apreq_hook_function_t hook,
                         apreq_hook_t *next,
                         void *ctx);
@@ -197,17 +197,10 @@
 
 
 /**
- * Create the default parser associated with the
- * current request's Content-Type (if possible).
- * @param env The current environment.
- * @param hook Hook(s) to add to the parser.
- * @return New parser, NULL if the Content-Type is
- * unrecognized.
- *
- * @param env The current environment.
- * @param hook Additional hooks to supply the parser with.
- * @return The parser; NULL if the environment's
- * Content-Type is unrecognized.
+ * Fetch the default parser function associated with the given MIME type.
+ * @param encytpe The desired enctype (can also be a full "Content-Type"
+ *        header).
+ * @return The parser function, or NULL if the enctype is unrecognized.
  */
 APREQ_DECLARE(apreq_parser_function_t)apreq_parser(const char *enctype);
 
@@ -248,5 +241,3 @@
 
 #endif
 #endif /* APREQ_PARSERS_H */
-
-

Modified: httpd/apreq/branches/multi-env-unstable/include/apreq_util.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/include/apreq_util.h?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_util.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_util.h Fri Feb 18 
14:07:36 2005
@@ -17,10 +17,9 @@
 #ifndef APREQ_UTIL_H
 #define APREQ_UTIL_H
 
-#include "apr_tables.h" 
 #include "apr_file_io.h"
 #include "apr_buckets.h"
-#include <stddef.h>
+#include "apreq.h"
 
 #ifdef  __cplusplus
  extern "C" {
@@ -39,15 +38,6 @@
  * @ingroup libapreq2
  */
 
-#ifndef WIN32
-#define APREQ_DECLARE(d)                APR_DECLARE(d)
-#define APREQ_DECLARE_NONSTD(d)         APR_DECLARE_NONSTD(d)
-#define APREQ_DECLARE_DATA
-#else
-#define APREQ_DECLARE(type)             __declspec(dllexport) type __stdcall
-#define APREQ_DECLARE_NONSTD(type)      __declspec(dllexport) type
-#define APREQ_DECLARE_DATA              __declspec(dllexport)
-#endif
 
 
 /**
@@ -56,82 +46,7 @@
  * buckets
 */
 
-#define APREQ_DEFAULT_READ_BLOCK_SIZE   (64  * 1024)
-#define APREQ_DEFAULT_READ_LIMIT        (64 * 1024 * 1024)
-#define APREQ_DEFAULT_BRIGADE_LIMIT     (256 * 1024)
-#define APREQ_DEFAULT_NELTS              8
 
-/**
- * Beginning work on error-codes ...
- *
- *
- */
-#ifndef APR_EBADARG
-#define APR_EBADARG                APR_BADARG   /* apr's unfixed booboo */
-#endif
-
-/* 0's: generic error status codes */
-#define APREQ_ERROR_GENERAL        APR_OS_START_USERERR
-#define APREQ_ERROR_INTERRUPT      APREQ_ERROR_GENERAL + 1
-
-/* 10's: malformed input */
-#define APREQ_ERROR_NODATA         APREQ_ERROR_GENERAL + 10
-#define APREQ_ERROR_BADSEQ         APREQ_ERROR_GENERAL + 11
-#define APREQ_ERROR_BADCHAR        APREQ_ERROR_GENERAL + 12
-#define APREQ_ERROR_BADTOKEN       APREQ_ERROR_GENERAL + 13
-#define APREQ_ERROR_NOTOKEN        APREQ_ERROR_GENERAL + 14
-#define APREQ_ERROR_BADATTR        APREQ_ERROR_GENERAL + 15
-#define APREQ_ERROR_BADHEADER      APREQ_ERROR_GENERAL + 16
-#define APREQ_ERROR_NOHEADER       APREQ_ERROR_GENERAL + 17
-
-/* 20's: misconfiguration */
-#define APREQ_ERROR_CONFLICT       APREQ_ERROR_GENERAL + 20
-#define APREQ_ERROR_NOPARSER       APREQ_ERROR_GENERAL + 21
-
-
-/* 30's: limit violations */
-#define APREQ_ERROR_OVERLIMIT      APREQ_ERROR_GENERAL + 30
-#define APREQ_ERROR_UNDERLIMIT     APREQ_ERROR_GENERAL + 31
-
-
-
-
-/** @brief libapreq's pre-extensible string type */
-typedef struct apreq_value_t {
-    char             *name;    /**< value name */
-    apr_size_t        size;    /**< value length (in bytes) */
-    char              data[1]; /**< value data  */
-} apreq_value_t;
-
-
-#define apreq_attr_to_type(T,A,P) ( (T*) ((char*)(P)-offsetof(T,A)) )
-
-/**
- * Construcs an apreq_value_t from the name/value info
- * supplied by the arguments.
- *
- * @param p     Pool for allocating the name and value.
- * @param name  Name of value.
- * @param nlen  Length of name.
- * @param val   Value data.
- * @param vlen  Length of val.
- * @return      apreq_value_t allocated from pool, 
- *              with v->data holding a copy of val, v->status = 0, and
- *              v->name pointing to a nul-terminated copy of name.
- */
-APREQ_DECLARE(apreq_value_t *) apreq_make_value(apr_pool_t *p, 
-                                                const char *name,
-                                                const apr_size_t nlen,
-                                                const char *val, 
-                                                const apr_size_t vlen);
-
-/** @enum apreq_join_t Join type */
-typedef enum { 
-    APREQ_JOIN_AS_IS,      /**< Join the strings without modification */
-    APREQ_JOIN_ENCODE,     /**< Url-encode the strings before joining them */
-    APREQ_JOIN_DECODE,     /**< Url-decode the strings before joining them */
-    APREQ_JOIN_QUOTE       /**< Quote the strings, backslashing existing quote 
marks. */
-} apreq_join_t;
 
 /**
  * Join an array of values.
@@ -146,13 +61,6 @@
                                        const apr_array_header_t *arr, 
                                        apreq_join_t mode);
 
-
-/** @enum apreq_match_t Match type */
-typedef enum {
-    APREQ_MATCH_FULL,       /**< Full match only. */
-    APREQ_MATCH_PARTIAL     /**< Partial matches are ok. */
-} apreq_match_t;
-
 /**
  * Returns offset of match string's location, or -1 if no match is found.
  * @param hay  Location of bytes to scan.
@@ -272,13 +180,6 @@
         return -1;
 }
 
-
-/** @enum apreq_expires_t Expiration date format */
-typedef enum {
-    APREQ_EXPIRES_HTTP,       /**< Use date formatting consistent with RFC 
2616 */
-    APREQ_EXPIRES_NSCOOKIE    /**< Use format consistent with Netscape's 
Cookie Spec */
-} apreq_expires_t;
-
 /**
  * Returns an RFC-822 formatted time string. Similar to ap_gm_timestr_822.
  *
@@ -414,17 +315,6 @@
                                                  apr_bucket_brigade *out, 
                                                  apr_bucket_brigade *in);
 
-
-/**
- * Initialize libapreq2. Applications (except apache modules using
- * mod_apreq) have to call this exactly once before they use
- * libapreq2.
- *
- * @param pool a base pool persisting while libapreq2 is used
- * @remark after you detroyed the pool, you have to call this function again
- *    with a new pool if you still plan to use libapreq2
- */
-APREQ_DECLARE(apr_status_t) apreq_initialize(apr_pool_t *pool);
 
 
 #ifdef __cplusplus

Modified: httpd/apreq/branches/multi-env-unstable/include/apreq_version.h
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/include/apreq_version.h?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_version.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_version.h Fri Feb 18 
14:07:36 2005
@@ -22,7 +22,7 @@
 #endif
 
 #include "apr_version.h"
-#include "apreq_util.h"
+#include "apreq.h"
 
 /**
  * @file apreq_version.h

Modified: httpd/apreq/branches/multi-env-unstable/library/Makefile.am
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/Makefile.am?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/Makefile.am (original)
+++ httpd/apreq/branches/multi-env-unstable/library/Makefile.am Fri Feb 18 
14:07:36 2005
@@ -5,7 +5,7 @@
 lib_LTLIBRARIES = libapreq2.la
 libapreq2_la_SOURCES = util.c version.c cookie.c param.c parser.c \
                        parser_urlencoded.c parser_header.c parser_multipart.c \
-                      module.c module_custom.c module_cgi.c
+                      module.c module_custom.c module_cgi.c error.c
 libapreq2_la_LDFLAGS = -version-info @APREQ_LIBTOOL_VERSION@
 
 pkgincludedir = $(includedir)/@APREQ_LIBNAME@

Modified: httpd/apreq/branches/multi-env-unstable/library/cookie.c
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/cookie.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/cookie.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/cookie.c Fri Feb 18 
14:07:36 2005
@@ -15,13 +15,14 @@
 */
 
 #include "apreq_cookie.h"
+#include "apreq_error.h"
+#include "apreq_util.h"
 #include "apr_strings.h"
 #include "apr_lib.h"
 #include "apr_date.h"
 
-#define RFC      APREQ_COOKIE_VERSION_RFC
-#define NETSCAPE APREQ_COOKIE_VERSION_NETSCAPE
-#define DEFAULT  APREQ_COOKIE_VERSION_DEFAULT
+#define RFC      1
+#define NETSCAPE 0
 
 #define ADD_COOKIE(j,c) apr_table_addn(j, c->v.name, c->v.data)
 
@@ -73,7 +74,7 @@
             ++val;
             --vlen;
         }
-        c->version = *val - '0';
+        apreq_cookie_version_set(c, *val - '0');
         return APR_SUCCESS;
 
     case 'e': case 'm': /* expires, max-age */
@@ -109,8 +110,10 @@
         break;
 
     case 's':
-        c->secure = (vlen > 0 && *val != '0' 
-                     && strncasecmp("off",val,vlen));
+        if (vlen > 0 && *val != '0' && strncasecmp("off",val,vlen))
+            apreq_cookie_secure_on(c);
+        else
+            apreq_cookie_secure_off(c);
         return APR_SUCCESS;
 
     };
@@ -141,15 +144,13 @@
     memcpy (v->name, name, nlen);
     v->name[nlen] = 0;
 
-    c->version = DEFAULT;
-
     /* session cookie is the default */
     c->max_age = -1;
 
     c->path = NULL;
     c->domain = NULL;
     c->port = NULL;
-    c->secure = 0; 
+    c->flags = 0; 
 
     c->comment = NULL;
     c->commentURL = NULL;
@@ -260,7 +261,7 @@
                                                      const char *hdr)
 {
     apreq_cookie_t *c;
-    apreq_cookie_version_t version;
+    unsigned version;
 
  parse_cookie_header:
 
@@ -350,7 +351,9 @@
                 return status;
 
             c = apreq_make_cookie(p, name, nlen, value, vlen);
-            c->version = version;
+            APREQ_FLAGS_ON(c->flags, APREQ_TAINT);
+            if (version != NETSCAPE)
+                apreq_cookie_version_set(c, version);
         }
     }
 
@@ -368,6 +371,7 @@
      *  over 100 should be fine.
      */
 
+    unsigned version = apreq_cookie_version(c);
     char format[128] = "%s=%s";
     char *f = format + strlen(format);
 
@@ -379,7 +383,7 @@
 #define NULL2EMPTY(attr) (attr ? attr : "")
 
 
-    if (c->version == NETSCAPE) {
+    if (version == NETSCAPE) {
         char expires[APR_RFC822_DATE_LEN] = {0};
 
 #define ADD_NS_ATTR(name) do {                  \
@@ -404,7 +408,7 @@
 
         f += strlen(f);
 
-        if (c->secure)
+        if (apreq_cookie_is_secure(c))
             strcpy(f, "; secure");
 
         return apr_snprintf(buf, len, format, c->v.name, c->v.data,
@@ -413,7 +417,7 @@
 
     /* c->version == RFC */
 
-    strcpy(f,"; Version=%d");
+    strcpy(f,"; Version=%u");
     f += strlen(f);
 
 /* ensure RFC attributes are always quoted */
@@ -438,10 +442,10 @@
 
     f += strlen(f);
 
-    if (c->secure)
+    if (apreq_cookie_is_secure(c))
         strcpy(f, "; secure");
 
-    return apr_snprintf(buf, len, format, c->v.name, c->v.data, c->version,
+    return apr_snprintf(buf, len, format, c->v.name, c->v.data, version,
                         NULL2EMPTY(c->path), NULL2EMPTY(c->domain), 
                         NULL2EMPTY(c->port), NULL2EMPTY(c->comment), 
                         NULL2EMPTY(c->commentURL), apr_time_sec(c->max_age));

Added: httpd/apreq/branches/multi-env-unstable/library/error.c
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/error.c?view=auto&rev=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/error.c (added)
+++ httpd/apreq/branches/multi-env-unstable/library/error.c Fri Feb 18 14:07:36 
2005
@@ -0,0 +1,76 @@
+/* Copyright 2000-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apreq_error.h"
+#include "apr_strings.h"
+
+/*
+ * stuffbuffer - like apr_cpystrn() but returns the address of the
+ * dest buffer instead of the address of the terminating '\0'
+ */
+static char *stuffbuffer(char *buf, apr_size_t bufsize, const char *s)
+{
+    apr_cpystrn(buf,s,bufsize);
+    return buf;
+}
+
+static const char *apreq_error_string(apr_status_t statcode)
+{
+    switch (statcode) {
+
+    case APREQ_ERROR_GENERAL:
+        return "Internal apreq error";
+
+    case APREQ_ERROR_NODATA:
+        return "Missing input data";
+
+    case APREQ_ERROR_BADSEQ:
+        return "Invalid byte sequence";
+
+    case APREQ_ERROR_BADCHAR:
+        return "Invalid character";
+
+    case APREQ_ERROR_BADTOKEN:
+        return "Invalid token";
+
+    case APREQ_ERROR_NOTOKEN:
+        return "Required token not found";
+
+    case APREQ_ERROR_BADATTR:
+        return "Unrecognized attribute";
+
+    case APREQ_ERROR_BADHEADER:
+        return "Malformed header string";
+
+    case APREQ_ERROR_NOPARSER:
+        return "Parser not found";
+
+    case APREQ_ERROR_TAINTED:
+        return "Attempt to perform unsafe action with tainted data";
+
+    default:
+        return "Error string not yet specified by apreq";
+    }
+}
+
+
+APREQ_DECLARE(char *) apreq_strerror(apr_status_t statcode, char *buf,
+                                 apr_size_t bufsize)
+{
+    if (statcode < APR_OS_START_USERERR || statcode >= APR_OS_START_EAIERR)
+        return apr_strerror(statcode, buf, bufsize);
+    return stuffbuffer(buf, bufsize, apreq_error_string(statcode));
+}
+

Modified: httpd/apreq/branches/multi-env-unstable/library/module.c
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/module.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/module.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/module.c Fri Feb 18 
14:07:36 2005
@@ -14,7 +14,8 @@
 **  limitations under the License.
 */
 
-#include "apreq.h"
+#include "apreq_module.h"
+#include "apreq_error.h"
 #include "apr_strings.h"
 #include "apr_lib.h"
 #include "apr_file_io.h"
@@ -28,10 +29,10 @@
     /* 0 -> non-netscape cookie found, stop.
        1 -> not found, keep going. */
 
-    return c->version == APREQ_COOKIE_VERSION_NETSCAPE;
+    return apreq_cookie_version(c);
 }
 
-APREQ_DECLARE(apreq_cookie_version_t)
+APREQ_DECLARE(unsigned)
     apreq_ua_cookie_version(apreq_handle_t *env)
 {
 
@@ -40,13 +41,13 @@
 
         if (apreq_jar(env, &j) != APR_SUCCESS
             || apr_table_do(has_rfc_cookie, NULL, j, NULL) == 1)
-            return APREQ_COOKIE_VERSION_NETSCAPE;
+            return 0;
 
         else
-            return APREQ_COOKIE_VERSION_RFC;
+            return 1;
     }
     else
-        return APREQ_COOKIE_VERSION_RFC;
+        return 1;
 }
 
 
@@ -54,7 +55,11 @@
                                               apreq_handle_t *env)
 {
     char s[APREQ_COOKIE_MAX_LENGTH];
-    int len = apreq_cookie_serialize(c, s, APREQ_COOKIE_MAX_LENGTH);
+    int len;
+    if (apreq_cookie_is_tainted(c))
+        return APREQ_ERROR_TAINTED;
+
+    len = apreq_cookie_serialize(c, s, APREQ_COOKIE_MAX_LENGTH);
 
     if (len >= APREQ_COOKIE_MAX_LENGTH)
         return APREQ_ERROR_OVERLIMIT;
@@ -66,9 +71,14 @@
                                                apreq_handle_t *env)
 {
     char s[APREQ_COOKIE_MAX_LENGTH];
-    int len = apreq_cookie_serialize(c, s, APREQ_COOKIE_MAX_LENGTH);
+    int len;
+
+    if (apreq_cookie_is_tainted(c))
+        return APREQ_ERROR_TAINTED;
+
+    len = apreq_cookie_serialize(c, s, APREQ_COOKIE_MAX_LENGTH);
 
-    if (c->version == APREQ_COOKIE_VERSION_NETSCAPE)
+    if (apreq_cookie_version(c) == 0)
         return APREQ_ERROR_CONFLICT;
 
     if (len >= APREQ_COOKIE_MAX_LENGTH)

Modified: httpd/apreq/branches/multi-env-unstable/library/module_cgi.c
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/module_cgi.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/module_cgi.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/module_cgi.c Fri Feb 18 
14:07:36 2005
@@ -15,7 +15,8 @@
 */
 #include <assert.h>
 
-#include "apreq.h"
+#include "apreq_module.h"
+#include "apreq_error.h"
 #include "apr_strings.h"
 #include "apr_lib.h"
 #include "apr_env.h"
@@ -233,7 +234,7 @@
             apreq_parser_function_t pf = apreq_parser(ct_header);
 
             if (pf != NULL) {
-                handle->parser = apreq_make_parser(handle->pool,
+                handle->parser = apreq_parser_make(handle->pool,
                                                    ba,
                                                    ct_header, 
                                                    pf,
@@ -308,7 +309,7 @@
         }
 
         handle->body_status =
-            apreq_run_parser(handle->parser, handle->body, bb);
+            apreq_parser_run(handle->parser, handle->body, bb);
         apr_brigade_destroy(bb);
         break;
 
@@ -336,7 +337,7 @@
         }
 
         handle->body_status =
-            apreq_run_parser(handle->parser, handle->body, bb);
+            apreq_parser_run(handle->parser, handle->body, bb);
         apr_brigade_destroy(bb);
         break;
 

Modified: httpd/apreq/branches/multi-env-unstable/library/module_custom.c
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/module_custom.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/module_custom.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/module_custom.c Fri Feb 18 
14:07:36 2005
@@ -15,7 +15,8 @@
 */
 
 #include "apr_strings.h"
-#include "apreq.h"
+#include "apreq_module.h"
+#include "apreq_error.h"
 
 #define READ_BYTES (64 * 1024)
 
@@ -59,7 +60,7 @@
         }
 
         handle->body_status = 
-            apreq_run_parser(handle->parser, handle->body, handle->in);
+            apreq_parser_run(handle->parser, handle->body, handle->in);
 
         apr_brigade_cleanup(handle->in);
         APR_BRIGADE_CONCAT(handle->in, bb);
@@ -79,7 +80,7 @@
             break;
         }
         handle->body_status = 
-            apreq_run_parser(handle->parser, handle->body, handle->in);
+            apreq_parser_run(handle->parser, handle->body, handle->in);
 
         apr_brigade_cleanup(handle->in);
         APR_BRIGADE_CONCAT(handle->in, bb);

Modified: httpd/apreq/branches/multi-env-unstable/library/param.c
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/param.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/param.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/param.c Fri Feb 18 14:07:36 
2005
@@ -15,6 +15,8 @@
 */
 
 #include "apreq_param.h"
+#include "apreq_error.h"
+#include "apreq_util.h"
 #include "apr_strings.h"
 #include "apr_lib.h"
 
@@ -22,7 +24,7 @@
 #define MAX_BRIGADE_LEN (1024 * 256)
 #define MAX_READ_AHEAD  (1024 * 64)
 
-APREQ_DECLARE(apreq_param_t *) apreq_make_param(apr_pool_t *p, 
+APREQ_DECLARE(apreq_param_t *) apreq_param_make(apr_pool_t *p, 
                                                 const char *name, 
                                                 const apr_size_t nlen, 
                                                 const char *val, 
@@ -32,14 +34,15 @@
     apreq_value_t *v;
     param->info = NULL;
     param->upload = NULL;
+    param->flags = 0; 
 
     *(const apreq_value_t **)&v = &param->v;
     v->size = vlen;
-    if (vlen)
+    if (vlen && val != NULL)
         memcpy(v->data, val, vlen);
     v->data[vlen] = 0;
     v->name = v->data + vlen + 1;
-    if (nlen)
+    if (nlen && name != NULL)
         memcpy(v->name, name, nlen);
     v->name[nlen] = 0;
 
@@ -47,7 +50,7 @@
 }
 
 
-APREQ_DECLARE(apr_status_t) apreq_decode_param(apreq_param_t **param,
+APREQ_DECLARE(apr_status_t) apreq_param_decode(apreq_param_t **param,
                                                apr_pool_t *pool, 
                                                const char *word,
                                                const apr_size_t nlen, 
@@ -84,7 +87,7 @@
 }
 
 
-APREQ_DECLARE(char *) apreq_encode_param(apr_pool_t *pool, 
+APREQ_DECLARE(char *) apreq_param_encode(apr_pool_t *pool, 
                                          const apreq_param_t *param)
 {
     apreq_value_t *v;
@@ -132,10 +135,11 @@
                 else
                     vlen = qs - start - nlen - 1;
 
-                s = apreq_decode_param(&param, pool, start, nlen, vlen);
+                s = apreq_param_decode(&param, pool, start, nlen, vlen);
                 if (s != APR_SUCCESS)
                     return s;
 
+                APREQ_FLAGS_ON(param->flags, APREQ_TAINT);
                 apr_table_addn(t, param->v.name, param->v.data);
             }
 

Modified: httpd/apreq/branches/multi-env-unstable/library/parser.c
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/parser.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/parser.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/parser.c Fri Feb 18 
14:07:36 2005
@@ -15,6 +15,7 @@
 */
 
 #include "apreq_parser.h"
+#include "apreq_util.h"
 #include "apr_strings.h"
 #include "apr_xml.h"
 #include "apr_hash.h"
@@ -30,7 +31,7 @@
 } while (0);
 
 APREQ_DECLARE(apreq_parser_t *)
-    apreq_make_parser(apr_pool_t *pool,
+    apreq_parser_make(apr_pool_t *pool,
                       apr_bucket_alloc_t *ba,
                       const char *content_type,
                       apreq_parser_function_t parser,
@@ -52,7 +53,7 @@
 }
 
 APREQ_DECLARE(apreq_hook_t *)
-    apreq_make_hook(apr_pool_t *pool,
+    apreq_hook_make(apr_pool_t *pool,
                     apreq_hook_function_t hook,
                     apreq_hook_t *next,
                     void *ctx)
@@ -189,7 +190,7 @@
 {
     apr_status_t s = APR_SUCCESS;
     if (hook->next)
-        s = apreq_run_hook(hook->next, param, bb);
+        s = apreq_hook_run(hook->next, param, bb);
     if (bb != NULL)
         apr_brigade_cleanup(bb);
     return s;
@@ -218,7 +219,7 @@
     if (ctx == NULL) {
         parser->ctx = ctx = apr_palloc(pool, sizeof *ctx);
         ctx->status = GEN_INCOMPLETE;
-        ctx->param = apreq_make_param(pool, 
+        ctx->param = apreq_param_make(pool, 
                                       "_dummy_", strlen("_dummy_"), "", 0);
         ctx->param->upload = apr_brigade_create(pool, parser->bucket_alloc);
         ctx->param->info = apr_table_make(pool, APREQ_DEFAULT_NELTS);
@@ -236,7 +237,7 @@
     }
 
     if (parser->hook != NULL) {
-        s = apreq_run_hook(parser->hook, ctx->param, bb);
+        s = apreq_hook_run(parser->hook, ctx->param, bb);
         if (s != APR_SUCCESS) {
             ctx->status = GEN_ERROR;
             return s;
@@ -299,7 +300,7 @@
             if (s == APR_SUCCESS) {
                 ctx->status = XML_COMPLETE;
                 if (hook->next)
-                    s = apreq_run_hook(hook->next, param, bb);
+                    s = apreq_hook_run(hook->next, param, bb);
             }
             else {
                 ctx->status = XML_ERROR;
@@ -327,7 +328,7 @@
     }
 
     if (hook->next)
-        return apreq_run_hook(hook->next, param, bb);
+        return apreq_hook_run(hook->next, param, bb);
 
     return APR_SUCCESS;
 }


Reply via email to