Author: joes
Date: Sun Feb 20 09:00:30 2005
New Revision: 154527
URL: http://svn.apache.org/viewcvs?view=rev&rev=154527
Log:
Move apreq_status_is_error to apreq_module_status_is_error, since
that's all it represents. Also drop apreq_*_(name|value) inlines;
apreq_value_t needs to remain a public struct.
Improved error codes in apreq_error.h, added new tests for apreq_strerrror.
Also includes whitespace cleanups for function declarations; started work
to bring doxygen docs back in sync.
The APR::Request:: perl glue is taking shape. The basic idea is
to directly map apreq_module.h to APR::Request, and map the remaining
apreq_foo.h to APR::Request::Foo.
Removed deprecated apreq_expires, apreq_make_*.
Renamed apreq_run_$foo apreq_$foo_run.
Dropped const qualifier from apreq_join's return value.
Added:
httpd/apreq/branches/multi-env-unstable/library/t/util.c
Modified:
httpd/apreq/branches/multi-env-unstable/STATUS
httpd/apreq/branches/multi-env-unstable/build/doxygen.conf.in
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/Cookie/Cookie.pm
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.pm
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.xs
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_functions.map
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_error.h
httpd/apreq/branches/multi-env-unstable/include/apreq_module.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/library/cookie.c
httpd/apreq/branches/multi-env-unstable/library/error.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/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/ (props changed)
httpd/apreq/branches/multi-env-unstable/library/t/Makefile.am
httpd/apreq/branches/multi-env-unstable/library/t/at.h
httpd/apreq/branches/multi-env-unstable/library/t/cookie.c
httpd/apreq/branches/multi-env-unstable/library/t/error.c
httpd/apreq/branches/multi-env-unstable/library/t/params.c
httpd/apreq/branches/multi-env-unstable/library/util.c
httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c
Modified: httpd/apreq/branches/multi-env-unstable/STATUS
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/STATUS?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/STATUS (original)
+++ httpd/apreq/branches/multi-env-unstable/STATUS Sun Feb 20 09:00:30 2005
@@ -52,6 +52,7 @@
TODO:
+
- Fix all the "//apreq_log" comments in the cgi tests.
- Let hooks interrupt parsers via APREQ_ERROR_INTERRUPT.
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/build/doxygen.conf.in (original)
+++ httpd/apreq/branches/multi-env-unstable/build/doxygen.conf.in Sun Feb 20
09:00:30 2005
@@ -8,7 +8,7 @@
REPEAT_BRIEF = YES
TAB_SIZE = 8
-ALIASES = "[EMAIL PROTECTED] The request handle.\n"
+ALIASES = "[EMAIL PROTECTED] The request handle"
OPTIMIZE_OUTPUT_FOR_C = YES
INTERNAL_DOCS = NO
Modified:
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=diff&r1=154526&r2=154527
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/cookie.pm
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/cookie.pm
Sun Feb 20 09:00:30 2005
@@ -8,13 +8,47 @@
use APR::Request::Cookie;
use APR::Request::Apache2;
+use APR::Table;
sub handler {
my $r = shift;
- plan $r, tests => 1;
+ plan $r, tests => 26;
+ $r->headers_in->{Cookie} = "foo=1;bar=2;foo=3;quux=4";
my $req = APR::Request::Apache2->new($r);
- ok not defined $req->jar;
+ ok defined $req->jar;
+
+ ok t_cmp $req->jar("foo"), 1, "scalar jar(foo)";
+ ok t_cmp $req->jar("bar"), 2, "scalar jar(bar)";
+ ok t_cmp $req->jar("quux"), 4, "scalar jar(quux)";
+
+ my @rv = $req->jar("foo");
+ ok t_cmp "@rv", "1 3", "list jar(foo)";
+ @rv = $req->jar("bar");
+ ok t_cmp "@rv", "2", "list jar(bar)";
+ @rv = $req->jar("quux");
+ ok t_cmp "@rv", "4", "list jar(quux)";
+
+ my $jar = $req->jar();
+ ok $jar->isa("APR::Request::Cookie::Table");
+ ok t_cmp $jar->{foo}, 1, '$jar->{foo} == 1';
+ ok t_cmp $jar->{bar}, 2, '$jar->{bar} == 2';
+ ok t_cmp $jar->{quux}, 4, '$jar->{quux} == 4';
+
+ my @k = qw/foo bar foo quux/;
+ my @v = 1..4;
+
+ ok t_cmp join(" ", keys %$jar), "foo bar foo quux", 'keys %$jar';
+ ok t_cmp join(" ", values %$jar), "1 2 3 4", 'values %$jar';
+
+ ok t_cmp join (" ", each %$jar), "$k[$_] $v[$_]", 'each %$jar: ' . $_
+ for 0..3;
+
+ ok t_cmp join(" ", $jar->get("foo")), "1 3", '$jar->get("foo")';
+
+ ok t_cmp $_->tainted, 1, "is tainted: $_" for values %$jar;
+ $_->tainted(0) for values %$jar;
+ ok t_cmp $_->tainted, 0, "not tainted: $_" for values %$jar;
return 0;
}
Modified:
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=diff&r1=154526&r2=154527
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/param.pm
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/param.pm
Sun Feb 20 09:00:30 2005
@@ -9,12 +9,45 @@
use APR::Request::Param;
use APR::Request::Apache2;
+
sub handler {
my $r = shift;
- plan $r, tests => 1;
+ plan $r, tests => 26;
+ $r->args("foo=1;bar=2;foo=3;quux=4");
my $req = APR::Request::Apache2->new($r);
- ok not defined $req->args;
+ ok defined $req->args;
+ ok t_cmp $req->args("foo"), 1, "scalar args(foo)";
+ ok t_cmp $req->args("bar"), 2, "scalar args(bar)";
+ ok t_cmp $req->args("quux"), 4, "scalar args(quux)";
+
+ my @rv = $req->args("foo");
+ ok t_cmp "@rv", "1 3", "list args(foo)";
+ @rv = $req->args("bar");
+ ok t_cmp "@rv", "2", "list args(bar)";
+ @rv = $req->args("quux");
+ ok t_cmp "@rv", "4", "list args(quux)";
+
+ my $args = $req->args();
+ ok $args->isa("APR::Request::Param::Table");
+ ok t_cmp $args->{foo}, 1, '$args->{foo} == 1';
+ ok t_cmp $args->{bar}, 2, '$args->{bar} == 2';
+ ok t_cmp $args->{quux}, 4, '$args->{quux} == 4';
+
+ my @k = qw/foo bar foo quux/;
+ my @v = 1..4;
+
+ ok t_cmp join(" ", keys %$args), "foo bar foo quux", 'keys %$args';
+ ok t_cmp join(" ", values %$args), "1 2 3 4", 'values %$args';
+
+ ok t_cmp join (" ", each %$args), "$k[$_] $v[$_]", 'each %$args: ' . $_
+ for 0..3;
+
+ ok t_cmp join(" ", $args->get("foo")), "1 3", '$args->get("foo")';
+
+ ok t_cmp $_->tainted, 1, "is tainted: $_" for values %$args;
+ $_->tainted(0) for values %$args;
+ ok t_cmp $_->tainted, 0, "not tainted: $_" for values %$args;
return 0;
}
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.pm
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.pm?view=diff&r1=154526&r2=154527
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.pm
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.pm
Sun Feb 20 09:00:30 2005
@@ -1 +1,2 @@
use APR::Request;
+eval 'use overload fallback => 1';
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=154526&r2=154527
==============================================================================
---
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
Sun Feb 20 09:00:30 2005
@@ -73,7 +73,7 @@
apr_status_t s;
s = apreq_jar(req, &t);
- if (apreq_status_is_error(s))
+ if (apreq_module_status_is_error(s))
APREQ_XS_THROW_ERROR(r, s, "APR::Request::jar", error_pkg);
XSRETURN_UNDEF;
@@ -86,7 +86,7 @@
s = apreq_jar(req, &t);
- if (apreq_status_is_error(s))
+ if (apreq_module_status_is_error(s))
APREQ_XS_THROW_ERROR(r, s, "APR::Request::jar", error_pkg);
if (t == NULL)
@@ -124,7 +124,7 @@
dXSARGS;
const apr_table_t *t;
apreq_handle_t *req;
- const char *elt_pkg = "APR::Request::Param";
+ const char *elt_pkg = "APR::Request::Cookie";
SV *sv, *t_obj, *r_obj;
IV iv;
@@ -289,3 +289,66 @@
);
newXS("APR::Request::Cookie::()", XS_APR__Request__Cookie_nil, file);
newXS("APR::Request::Cookie::(\"\"", XS_APR__Request__Cookie_value, file);
+
+
+MODULE = APR::Request::Cookie PACKAGE = APR::Request::Cookie
+
+char *
+name(obj)
+ APR::Request::Cookie obj
+
+ CODE:
+ RETVAL = obj->v.name;
+
+ OUTPUT:
+ RETVAL
+
+UV
+secure(obj, val=NULL)
+ APR::Request::Cookie obj
+ SV *val
+
+ CODE:
+ RETVAL = apreq_cookie_is_secure(obj);
+ if (items == 2) {
+ if (SvTRUE(val))
+ apreq_cookie_secure_on(obj);
+ else
+ apreq_cookie_secure_off(obj);
+ }
+
+ OUTPUT:
+ RETVAL
+
+UV
+version(obj, val=0)
+ APR::Request::Cookie obj
+ UV val
+
+ CODE:
+ RETVAL = apreq_cookie_version(obj);
+ if (items == 2)
+ apreq_cookie_version_set(obj, val);
+
+ OUTPUT:
+ RETVAL
+
+IV
+tainted(obj, val=NULL)
+ APR::Request::Cookie obj
+ SV *val
+ PREINIT:
+ /*nada*/
+
+ CODE:
+ RETVAL = apreq_cookie_is_tainted(obj);
+
+ if (items == 2) {
+ if (SvTRUE(val))
+ apreq_cookie_taint_on(obj);
+ else
+ apreq_cookie_taint_off(obj);
+ }
+
+ OUTPUT:
+ RETVAL
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.pm
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.pm?view=diff&r1=154526&r2=154527
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.pm
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Param/Param.pm
Sun Feb 20 09:00:30 2005
@@ -1 +1,2 @@
use APR::Request;
+eval 'use overload fallback => 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=154526&r2=154527
==============================================================================
---
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
Sun Feb 20 09:00:30 2005
@@ -74,7 +74,7 @@
apr_status_t s;
s = apreq_args(req, &t);
- if (apreq_status_is_error(s))
+ if (apreq_module_status_is_error(s))
APREQ_XS_THROW_ERROR(r, s, "APR::Request::args", error_pkg);
XSRETURN_UNDEF;
@@ -87,7 +87,7 @@
s = apreq_args(req, &t);
- if (apreq_status_is_error(s))
+ if (apreq_module_status_is_error(s))
APREQ_XS_THROW_ERROR(r, s, "APR::Request::args", error_pkg);
if (t == NULL)
@@ -151,7 +151,7 @@
apr_status_t s;
s = apreq_body(req, &t);
- if (apreq_status_is_error(s))
+ if (apreq_module_status_is_error(s))
APREQ_XS_THROW_ERROR(r, s, "APR::Request::body", error_pkg);
XSRETURN_UNDEF;
@@ -164,7 +164,7 @@
s = apreq_body(req, &t);
- if (apreq_status_is_error(s))
+ if (apreq_module_status_is_error(s))
APREQ_XS_THROW_ERROR(r, s, "APR::Request::body", error_pkg);
if (t == NULL)
@@ -369,3 +369,35 @@
newXS("APR::Request::Param::(\"\"", XS_APR__Request__Param_value, file);
+MODULE = APR::Request::Param PACKAGE = APR::Request::Param
+
+char *
+name(obj)
+ APR::Request::Param obj
+
+ CODE:
+ RETVAL = obj->v.name;
+
+ OUTPUT:
+ RETVAL
+
+
+IV
+tainted(obj, val=NULL)
+ APR::Request::Param obj
+ SV *val
+ PREINIT:
+ /*nada*/
+
+ CODE:
+ RETVAL = apreq_param_is_tainted(obj);
+
+ if (items == 2) {
+ if (SvTRUE(val))
+ apreq_param_taint_on(obj);
+ else
+ apreq_param_taint_off(obj);
+ }
+
+ OUTPUT:
+ RETVAL
Modified:
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=diff&r1=154526&r2=154527
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
Sun Feb 20 09:00:30 2005
@@ -5,6 +5,155 @@
XSRETURN_EMPTY;
}
+static XS(apreq_xs_parse)
+{
+ dXSARGS;
+ apreq_handle_t *req;
+ apr_status_t s;
+ const apr_table_t *t;
+ SV *sv, *obj;
+ IV iv;
+
+ if (items != 1 || !SvROK(ST(0)) || !sv_derived_from(ST(0), "APR::Request"))
+ Perl_croak(aTHX_ "Usage: APR::Request::parse($req)");
+
+ sv = ST(0);
+ obj = apreq_xs_find_obj(aTHX_ sv, "r");
+ iv = SvIVX(SvRV(obj));
+ req = INT2PTR(apreq_handle_t *, iv);
+
+ XSprePUSH;
+ EXTEND(SP, 3);
+ s = apreq_jar(req, &t);
+ PUSHs(sv_2mortal(newSViv(s)));
+ s = apreq_args(req, &t);
+ PUSHs(sv_2mortal(newSViv(s)));
+ s = apreq_body(req, &t);
+ PUSHs(sv_2mortal(newSViv(s)));
+
+ PUTBACK;
+}
+
+MODULE = APR::Request PACKAGE = APR::Request
+
+SV*
+read_limit(req, val=NULL)
+ APR::Request req
+ SV *val
+ PREINIT:
+ /* nada */
+ CODE:
+ if (items == 1) {
+ apr_status_t s;
+ apr_uint64_t bytes;
+ s = apreq_read_limit_get(req, &bytes);
+ if (s != APR_SUCCESS) {
+ SV *sv = ST(0), *obj = ST(0);
+ APREQ_XS_THROW_ERROR(r, s,
+ "APR::Request::read_limit", "APR::Request::Error");
+ RETVAL = &PL_sv_undef;
+ }
+ else {
+ RETVAL = newSVuv(bytes);
+ }
+ }
+ else {
+ apr_status_t s = apreq_read_limit_set(req, SvUV(val));
+ if (s != APR_SUCCESS) {
+ if (GIMME_V == G_VOID) {
+ SV *sv = ST(0), *obj = ST(0);
+ APREQ_XS_THROW_ERROR(r, s,
+ "APR::Request::read_limit", "APR::Request::Error");
+ }
+ RETVAL = &PL_sv_no;
+ }
+ else {
+ RETVAL = &PL_sv_yes;
+ }
+ }
+
+ OUTPUT:
+ RETVAL
+
+SV*
+brigade_limit(req, val=NULL)
+ APR::Request req
+ SV *val
+ PREINIT:
+ /* nada */
+ CODE:
+ if (items == 1) {
+ apr_status_t s;
+ apr_size_t bytes;
+ s = apreq_brigade_limit_get(req, &bytes);
+ if (s != APR_SUCCESS) {
+ SV *sv = ST(0), *obj = ST(0);
+ APREQ_XS_THROW_ERROR(r, s,
+ "APR::Request::brigade_limit", "APR::Request::Error");
+ RETVAL = &PL_sv_undef;
+ }
+ else {
+ RETVAL = newSVuv(bytes);
+ }
+ }
+ else {
+ apr_status_t s = apreq_brigade_limit_set(req, SvUV(val));
+ if (s != APR_SUCCESS) {
+ if (GIMME_V == G_VOID) {
+ SV *sv = ST(0), *obj = ST(0);
+ APREQ_XS_THROW_ERROR(r, s,
+ "APR::Request::brigade_limit", "APR::Request::Error");
+ }
+ RETVAL = &PL_sv_no;
+ }
+ else {
+ RETVAL = &PL_sv_yes;
+ }
+ }
+
+ OUTPUT:
+ RETVAL
+
+
+SV*
+temp_dir(req, val=NULL)
+ APR::Request req
+ SV *val
+ PREINIT:
+ /* nada */
+ CODE:
+ if (items == 1) {
+ apr_status_t s;
+ const char *path;
+ s = apreq_temp_dir_get(req, &path);
+ if (s != APR_SUCCESS) {
+ SV *sv = ST(0), *obj = ST(0);
+ APREQ_XS_THROW_ERROR(r, s,
+ "APR::Request::temp_dir", "APR::Request::Error");
+ RETVAL = &PL_sv_undef;
+ }
+ else {
+ RETVAL = (path == NULL) ? &PL_sv_undef : newSVpv(path, 0);
+ }
+ }
+ else {
+ apr_status_t s = apreq_temp_dir_set(req, SvPV_nolen(val));
+ if (s != APR_SUCCESS) {
+ if (GIMME_V == G_VOID) {
+ SV *sv = ST(0), *obj = ST(0);
+ APREQ_XS_THROW_ERROR(r, s,
+ "APR::Request::temp_dir", "APR::Request::Error");
+ }
+ RETVAL = &PL_sv_no;
+ }
+ else {
+ RETVAL = &PL_sv_yes;
+ }
+ }
+
+ OUTPUT:
+ RETVAL
+
MODULE = APR::Request PACKAGE = APR::Request::Error
@@ -37,4 +186,5 @@
);
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/maps/apreq_functions.map
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_functions.map?view=diff&r1=154526&r2=154527
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_functions.map
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_functions.map
Sun Feb 20 09:00:30 2005
@@ -106,7 +106,17 @@
#################### APR::Request stuff ####################
MODULE=APR::Request PACKAGE=APR::Request PREFIX=apreq_
-apreq_parse
+apreq_hook_add
+apreq_header_in
+apreq_header_out
+
+
+MODULE=APR::Request PACKAGE=APR::Request PREFIX=APR__Request_
+DEFINE_parse | apreq_xs_parse |
+
+
+MODULE=APR::Request PACKAGE=APR::Request PREFIX=APR__Request_
+DEFINE_parse | apreq_xs_parse |
MODULE=APR::Request::Apache2 PACKAGE=APR::Request::Apache2
apreq_handle_apache2_t *:DEFINE_new | apreq_handle_apache2 (r) | const char
*:class, request_rec *:r
@@ -118,7 +128,6 @@
#################### APR::Request::Cookie stuff ####################
MODULE=APR::Request::Cookie PACKAGE=APR::Request::Cookie PREFIX=apreq_cookie_
-apreq_cookie_name
apreq_cookie_bake | apreq_cookie_bake(c, req) | apreq_cookie_t *:c,
apreq_handle_t *:req=apreq_xs_get_handle(aTHX_ ST(0))
apreq_cookie_bake2 | apreq_cookie_bake2(c, req) | apreq_cookie_t *:c,
apreq_handle_t *:req=apreq_xs_get_handle(aTHX_ ST(0))
@@ -135,9 +144,6 @@
#################### APR::Request::Param stuff ####################
-
-MODULE=APR::Request::Param PACKAGE=APR::Request::Param PREFIX=apreq_param_
-apreq_param_name
MODULE=APR::Request::Param PACKAGE=APR::Request PREFIX=APR__Request_
DEFINE_args | apreq_xs_args |
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=154526&r2=154527
==============================================================================
---
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
Sun Feb 20 09:00:30 2005
@@ -15,13 +15,6 @@
<apreq_handle_t MODULE=APR::Request::Handle>
! module
-#! args
-#! body
-#! parser
-#! cfg
-#! env
-# args_status
-# body_status
</apreq_handle_t>
<apreq_cookie_t MODULE=APR::Request::Cookie>
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=154526&r2=154527
==============================================================================
---
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
Sun Feb 20 09:00:30 2005
@@ -23,7 +23,7 @@
struct apreq_param_t | APR::Request::Param
struct apreq_cookie_t | APR::Request::Cookie
-struct apreq_handle_t | APR::Request | T_APREQ_HANDLE
+struct apreq_handle_t | APR::Request | T_APREQ_HANDLE | req
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq.h Sun Feb 20 09:00:30
2005
@@ -34,6 +34,8 @@
#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)
@@ -98,7 +100,7 @@
* libapreq2.
*
* @param pool a base pool persisting while libapreq2 is used
- * @remark after you detroyed the pool, you have to call this function again
+ * @remarks 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);
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_cookie.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_cookie.h Sun Feb 20
09:00:30 2005
@@ -72,13 +72,6 @@
apreq_attr_to_type(apreq_value_t, data, deconst.out));
}
-static APR_INLINE
-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) {
@@ -131,9 +124,9 @@
}
-APREQ_DECLARE(apr_status_t)apreq_parse_cookie_header(apr_pool_t *pool,
- apr_table_t *jar,
- const char *header);
+APREQ_DECLARE(apr_status_t) apreq_parse_cookie_header(apr_pool_t *pool,
+ apr_table_t *jar,
+ const char *header);
/**
* Returns a new cookie, made from the argument list.
@@ -145,10 +138,10 @@
* @param vlen Length of value.
*/
APREQ_DECLARE(apreq_cookie_t *) apreq_cookie_make(apr_pool_t *pool,
- const char *name, const apr_size_t nlen,
- const char *value, const apr_size_t vlen);
-
-#define apreq_make_cookie(p,n,nl,v,vl) apreq_cookie_make(p,n,nl,v,vl)
+ const char *name,
+ const apr_size_t nlen,
+ const char *value,
+ const apr_size_t vlen);
/**
* Sets the associated cookie attribute.
@@ -161,10 +154,12 @@
* @param vlen Length of new attribute.
* @remarks Ensures cookie version & time are kept in sync.
*/
-APREQ_DECLARE(apr_status_t)
- apreq_cookie_attr(apr_pool_t *p, apreq_cookie_t *c,
- const char *attr, apr_size_t alen,
- const char *val, apr_size_t vlen);
+APREQ_DECLARE(apr_status_t) apreq_cookie_attr(apr_pool_t *p,
+ apreq_cookie_t *c,
+ const char *attr,
+ apr_size_t alen,
+ const char *val,
+ apr_size_t vlen);
/**
@@ -192,8 +187,6 @@
APREQ_DECLARE(int) apreq_cookie_serialize(const apreq_cookie_t *c,
char *buf, apr_size_t len);
-#define apreq_serialize_cookie(buf,len,c) apreq_cookie_serialize(c,buf,len)
-
/**
* Set the Cookie's expiration date.
*
@@ -204,6 +197,9 @@
* is not NULL, the expiration date will be reset to the offset (from now)
* represented by time_str. The time_str should be in a format that
* apreq_atoi64t() can understand, namely /[+-]?\d+\s*[YMDhms]/.
+ *
+ * @remarks Now time_str may also be a fixed date; see apr_date_parse_rfc()
+ * for admissible formats.
*/
APREQ_DECLARE(void) apreq_cookie_expires(apreq_cookie_t *c,
const char *time_str);
Modified: 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=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_error.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_error.h Sun Feb 20
09:00:30 2005
@@ -38,46 +38,29 @@
/* 0's: generic error status codes */
#define APREQ_ERROR_GENERAL APR_OS_START_USERERR
-#define APREQ_ERROR_INTERRUPT APREQ_ERROR_GENERAL + 1
+#define APREQ_ERROR_TAINTED (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;
- }
-}
-
-
+#define APREQ_ERROR_BADDATA (APREQ_ERROR_GENERAL + 10)
+#define APREQ_ERROR_BADSEQ (APREQ_ERROR_BADDATA + 1)
+#define APREQ_ERROR_BADCHAR (APREQ_ERROR_BADDATA + 2)
+#define APREQ_ERROR_BADTOKEN (APREQ_ERROR_BADDATA + 3)
+#define APREQ_ERROR_NOTOKEN (APREQ_ERROR_BADDATA + 4)
+#define APREQ_ERROR_BADATTR (APREQ_ERROR_BADDATA + 5)
+#define APREQ_ERROR_BADHEADER (APREQ_ERROR_BADDATA + 6)
+
+/* 20's: missing input */
+#define APREQ_ERROR_NODATA (APREQ_ERROR_GENERAL + 20)
+#define APREQ_ERROR_NOATTR (APREQ_ERROR_NODATA + 1)
+#define APREQ_ERROR_NOHEADER (APREQ_ERROR_NODATA + 2)
+#define APREQ_ERROR_NOPARSER (APREQ_ERROR_NODATA + 3)
+
+
+/* 30's: configuration conflicts */
+#define APREQ_ERROR_MISMATCH (APREQ_ERROR_GENERAL + 30)
+#define APREQ_ERROR_OVERLIMIT (APREQ_ERROR_MISMATCH + 1)
+#define APREQ_ERROR_UNDERLIMIT (APREQ_ERROR_MISMATCH + 2)
+#define APREQ_ERROR_NOTEMPTY (APREQ_ERROR_MISMATCH + 3)
#ifdef __cplusplus
Modified: 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=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_module.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_module.h Sun Feb 20
09:00:30 2005
@@ -19,6 +19,7 @@
#include "apreq_cookie.h"
#include "apreq_parser.h"
+#include "apreq_error.h"
#ifdef __cplusplus
extern "C" {
@@ -67,6 +68,21 @@
apr_status_t (*header_out)(apreq_handle_t *, const char *,char *);
} apreq_module_t;
+
+
+static APR_INLINE
+unsigned char apreq_module_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;
+ }
+}
/**
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_param.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_param.h Sun Feb 20
09:00:30 2005
@@ -22,11 +22,11 @@
#ifdef __cplusplus
extern "C" {
-#endif /* __cplusplus */
+#endif
/**
- * @file apreq_params.h
+ * @file apreq_param.h
* @brief Request parsing and parameter API
* @ingroup libapreq2
*/
@@ -40,12 +40,6 @@
const apreq_value_t v; /**< underlying name/value/status info */
} apreq_param_t;
-static APR_INLINE
-const char *apreq_param_name(const apreq_param_t *p) { return p->v.name; }
-
-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
@@ -73,16 +67,16 @@
union { const char *in; char *out; } deconst;
deconst.in = val;
- return apreq_attr_to_type(apreq_param_t, v,
+ 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_param_make(apr_pool_t *p,
- const char *name,
- const apr_size_t nlen,
- const char *val,
+APREQ_DECLARE(apreq_param_t *) apreq_param_make(apr_pool_t *p,
+ const char *name,
+ const apr_size_t nlen,
+ const char *val,
const apr_size_t vlen);
/**
@@ -96,18 +90,18 @@
*
*/
APREQ_DECLARE(apr_status_t) apreq_param_decode(apreq_param_t **param,
- apr_pool_t *pool,
+ apr_pool_t *pool,
const char *word,
- const apr_size_t nlen,
+ const apr_size_t nlen,
const apr_size_t vlen);
+
/**
* Url-encodes the param into a name-value pair.
* @param pool Pool which allocates the returned string.
* @param param Param to encode.
* @return name-value pair representing the param.
*/
-
-APREQ_DECLARE(char *) apreq_param_encode(apr_pool_t *pool,
+APREQ_DECLARE(char *) apreq_param_encode(apr_pool_t *pool,
const apreq_param_t *param);
/**
@@ -121,13 +115,11 @@
* as a name-value pair with value-length = 0.
*
*/
-
APREQ_DECLARE(apr_status_t) apreq_parse_query_string(apr_pool_t *pool,
- apr_table_t *t,
+ apr_table_t *t,
const char *qs);
-
/**
* Returns an array of parameters (apreq_param_t *) matching the given key.
* The key is case-insensitive.
@@ -163,9 +155,8 @@
* @return Upload table.
* @remark Will parse the request if necessary.
*/
-
-APREQ_DECLARE(const apr_table_t *)
- apreq_uploads(const apr_table_t *body, apr_pool_t *pool);
+APREQ_DECLARE(const apr_table_t *) apreq_uploads(const apr_table_t *body,
+ apr_pool_t *pool);
/**
* Returns the first param in req->body which has both param->v.name
@@ -175,16 +166,15 @@
* @return Corresponding upload, NULL if none found.
* @remark Will parse the request as necessary.
*/
-
-APREQ_DECLARE(const apreq_param_t *)
- apreq_upload(const apr_table_t *body, const char *name);
+APREQ_DECLARE(const apreq_param_t *) apreq_upload(const apr_table_t *body,
+ const char *name);
#ifdef __cplusplus
}
-
#endif
-#endif /* APREQ_PARAMS_H */
+
+#endif /* APREQ_PARAM_H */
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_parser.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_parser.h Sun Feb 20
09:00:30 2005
@@ -93,7 +93,8 @@
*/
static APR_INLINE
apr_status_t apreq_parser_run(struct apreq_parser_t *psr, apr_table_t *t,
- apr_bucket_brigade *bb) {
+ apr_bucket_brigade *bb)
+{
return psr->parser(psr, t, bb);
}
@@ -106,7 +107,8 @@
*/
static APR_INLINE
apr_status_t apreq_hook_run(struct apreq_hook_t *h, apreq_param_t *param,
- apr_bucket_brigade *bb) {
+ apr_bucket_brigade *bb)
+{
return h->hook(h, param, bb);
}
@@ -160,15 +162,14 @@
* @param ctx Parser's internal scratch pad.
* @return New parser.
*/
-APREQ_DECLARE(apreq_parser_t *)
- apreq_parser_make(apr_pool_t *pool,
- apr_bucket_alloc_t *bucket_alloc,
- const char *content_type,
- apreq_parser_function_t parser,
- apr_size_t brigade_limit,
- const char *temp_dir,
- apreq_hook_t *hook,
- void *ctx);
+APREQ_DECLARE(apreq_parser_t *) apreq_parser_make(apr_pool_t *pool,
+ apr_bucket_alloc_t *ba,
+ const char *content_type,
+ apreq_parser_function_t pfn,
+ apr_size_t brigade_limit,
+ const char *temp_dir,
+ apreq_hook_t *hook,
+ void *ctx);
/**
* Construct a hook.
@@ -179,11 +180,10 @@
* @param ctx Hook's internal scratch pad.
* @return New hook.
*/
-APREQ_DECLARE(apreq_hook_t *)
- apreq_hook_make(apr_pool_t *pool,
- apreq_hook_function_t hook,
- apreq_hook_t *next,
- void *ctx);
+APREQ_DECLARE(apreq_hook_t *) apreq_hook_make(apr_pool_t *pool,
+ apreq_hook_function_t hook,
+ apreq_hook_t *next,
+ void *ctx);
/**
@@ -219,7 +219,7 @@
*/
APREQ_DECLARE(apr_status_t) apreq_register_parser(const char *enctype,
- apreq_parser_function_t
parser);
+ apreq_parser_function_t pfn);
/**
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_util.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_util.h Sun Feb 20
09:00:30 2005
@@ -26,62 +26,59 @@
#endif
/**
- * The objects in apreq.h are used in various contexts:
+ * This header contains useful functions for creating new
+ * parsers, hooks or modules. It includes
*
- * - apreq_value_t - the base struct for params & cookies
* - string <-> array converters
* - substring search functions
* - simple encoders & decoders for urlencoded strings
* - simple time, date, & file-size converters
- * @file apreq.h
- * @brief Common functions, structures and macros.
+ * @file apreq_util.h
+ * @brief Utility functions for apreq.
* @ingroup libapreq2
*/
-
-
-/**
- * Commong Defaults.
- * Maximum amount of heap space a brigade may use before switching to file
- * buckets
-*/
-
-
-
/**
* Join an array of values.
+ *
* @param p Pool to allocate return value.
* @param sep String that is inserted between the joined values.
- * @param arr Array of values.
+ * @param arr Array of apreq_value_t entries.
* @param mode Join type- see apreq_join_t.
- * @remark Return string can be upgraded to an apreq_value_t.
+ *
+ * @return Resulting string; can be upgraded to an apreq_value_t.
*/
-APREQ_DECLARE(const char *) apreq_join(apr_pool_t *p,
- const char *sep,
- const apr_array_header_t *arr,
- apreq_join_t mode);
+APREQ_DECLARE(char *) apreq_join(apr_pool_t *p,
+ const char *sep,
+ const apr_array_header_t *arr,
+ apreq_join_t mode);
/**
* Returns offset of match string's location, or -1 if no match is found.
+ *
* @param hay Location of bytes to scan.
* @param hlen Number of bytes available for scanning.
* @param ndl Search string
* @param nlen Length of search string.
* @param type Match type.
+ *
* @return Offset of match string, or -1 if mo match is found.
*
*/
APREQ_DECLARE(apr_ssize_t) apreq_index(const char* hay, apr_size_t hlen,
const char* ndl, apr_size_t nlen,
const apreq_match_t type);
+
/**
* Places a quoted copy of src into dest. Embedded quotes are escaped with a
* backslash ('\').
+ *
* @param dest Location of quoted copy. Must be large enough to hold the copy
* and trailing null byte.
* @param src Original string.
* @param slen Length of original string.
* @param dest Destination string.
+ *
* @return length of quoted copy in dest.
*/
APREQ_DECLARE(apr_size_t) apreq_quote(char *dest, const char *src,
@@ -90,11 +87,13 @@
/**
* Same as apreq_quote() except when src begins and ends in quote marks. In
* that case it assumes src is quoted correctly, and just copies src to dest.
+ *
* @param dest Location of quoted copy. Must be large enough to hold the copy
* and trailing null byte.
* @param src Original string.
* @param slen Length of original string.
* @param dest Destination string.
+ *
* @return length of quoted copy in dest.
*/
APREQ_DECLARE(apr_size_t) apreq_quote_once(char *dest, const char *src,
@@ -102,10 +101,12 @@
/**
* Url-encodes a string.
+ *
* @param dest Location of url-encoded result string. Caller must ensure it
* is large enough to hold the encoded string and trailing '\0'.
* @param src Original string.
* @param slen Length of original string.
+ *
* @return length of url-encoded string in dest.
*/
APREQ_DECLARE(apr_size_t) apreq_encode(char *dest, const char *src,
@@ -113,44 +114,58 @@
/**
* Url-decodes a string.
+ *
* @param dest Location of url-encoded result string. Caller must ensure dest
is
* large enough to hold the encoded string and trailing null
character.
* @param dlen points to resultant length of url-decoded string in dest
* @param src Original string.
* @param slen Length of original string.
- * @return APR_SUCCESS, error otherwise.
+ *
+ * @return ::APR_SUCCESS.
+ * @return ::APREQ_ERROR_BADSEQ or ::APREQ_ERROR_BADCHAR on malformed input.
+ *
+ * @remarks In the non-APR_SUCCESS case, dlen will be set to include
+ * the last succesfully decoded value.
*/
APREQ_DECLARE(apr_status_t) apreq_decode(char *dest, apr_size_t *dlen,
const char *src, apr_size_t slen);
-
/**
* Url-decodes an iovec array.
- * @param dest Location of url-encoded result string. Caller must ensure dest
is
- * large enough to hold the encoded string and trailing null
character.
+ *
+ * @param dest Location of url-encoded result string. Caller must ensure dest
is
+ * large enough to hold the encoded string and trailing null
character.
* @param dlen Resultant length of dest.
- * @param v Array of iovecs that represent the source string
+ * @param v Array of iovecs that represent the source string
* @param nelts Number of iovecs in the array.
- * @return APR_SUCCESS on success, APR_INCOMPLETE if the iovec ends in the
- * middle of an %XX escape sequence, error otherwise.
+ *
+ * @return ::APR_SUCCESS.
+ * @return ::APR_INCOMPLETE if the iovec ends in the middle of an %XX escape
+ * sequence.
+ * @return ::APREQ_ERROR_BADSEQ or ::APREQ_ERROR_BADCHAR on malformed input.
+ *
+ * @remarks In the non-APR_SUCCESS case, dlen will be set to include
+ * the last succesfully decoded value.
*/
-APREQ_DECLARE(apr_status_t) apreq_decodev(char *d, apr_size_t *dlen,
+APREQ_DECLARE(apr_status_t) apreq_decodev(char *dest, apr_size_t *dlen,
struct iovec *v, int nelts);
/**
* Returns an url-encoded copy of a string.
+ *
* @param p Pool used to allocate the return value.
* @param src Original string.
* @param slen Length of original string.
- * @remark Use this function insead of apreq_encode if its caller might
otherwise
- * overflow dest.
+ *
+ * @return The url-encoded string.
+ *
+ * @remarks Use this function insead of apreq_encode if its
+ * caller might otherwise overflow dest.
*/
-
static APR_INLINE
-char *apreq_escape(apr_pool_t *p,
- const char *src, const apr_size_t slen)
+char *apreq_escape(apr_pool_t *p, const char *src, const apr_size_t slen)
{
char *rv;
@@ -164,13 +179,14 @@
/**
* An \e in-situ url-decoder.
+ *
* @param str The string to decode
+ *
* @return Length of decoded string, or < 0 on error.
- * @remark Equivalent to apreq_decode(str,str,strlen(str)).
+ *
+ * @remarks Equivalent to apreq_decode(str,str,strlen(str)).
*/
-
-static APR_INLINE
-apr_ssize_t apreq_unescape(char *str)
+static APR_INLINE apr_ssize_t apreq_unescape(char *str)
{
apr_size_t len;
apr_status_t rv = apreq_decode(str,&len,str,strlen(str));
@@ -181,47 +197,45 @@
}
/**
- * Returns an RFC-822 formatted time string. Similar to ap_gm_timestr_822.
- *
- * @param p Pool to allocate return string.
- * @param time_str YMDhms time units (from now) until expiry.
- * Understands "now".
- * @param type ::APREQ_EXPIRES_HTTP for RFC822 dates,
- * ::APREQ_EXPIRES_NSCOOKIE for Netscape cookie dates.
- * @return Date string, (time_str is offset from "now") formatted
- * according to type.
- * @deprecated Use apr_rfc822_date instead. ::APREQ_EXPIRES_NSCOOKIE strings
- * are formatted with a '-' (instead of a ' ') character at
- * offsets 7 and 11.
- */
-
-APREQ_DECLARE(char *) apreq_expires(apr_pool_t *p, const char *time_str,
- const apreq_expires_t type);
-
-/**
* Converts file sizes (KMG) to bytes
+ *
* @param s file size matching m/^\d+[KMG]b?$/i
+ *
* @return 64-bit integer representation of s.
+ *
+ * @remarks XXX What happens when s is malformed? Should this return
+ * an unsigned value instead?
*/
APREQ_DECLARE(apr_int64_t) apreq_atoi64f(const char *s);
/**
* Converts time strings (YMDhms) to seconds
+ *
* @param s time string matching m/^\+?\d+[YMDhms]$/
+ *
* @return 64-bit integer representation of s as seconds.
+ *
+ * @remarks XXX What happens when s is malformed? Should this return
+ * an unsigned value instead?
*/
APREQ_DECLARE(apr_int64_t) apreq_atoi64t(const char *s);
/**
* Writes brigade to a file.
+ *
* @param f File that gets the brigade.
* @param wlen On a successful return, wlen holds the length of
* the brigade, which is the amount of data written to
* the file.
* @param bb Bucket brigade.
- * @remark In the future, this function may do something
+ *
+ * @return ::APR_SUCCESS.
+ * @return XXX error code resulting from apr_bucket_read().
+ * @return XXX error code resulting from apr_file_writev().
+ *
+ * @remarks In the future, this function may do something
* intelligent with file buckets.
*/
@@ -230,6 +244,7 @@
apr_bucket_brigade *bb);
/**
* Makes a temporary file.
+ *
* @param fp Points to the temporary apr_file_t on success.
* @param pool Pool to associate with the temp file. When the
* pool is destroyed, the temp file will be closed
@@ -237,7 +252,10 @@
* @param path The base directory which will contain the temp file.
* If param == NULL, the directory will be selected via
* tempnam(). See the tempnam manpage for details.
- * @return APR_SUCCESS on success; error code otherwise.
+ *
+ * @return ::APR_SUCCESS.
+ * @return XXX error code resulting from apreq_filepath_merge().
+ * @return XXX error code resulting from apr_file_mktemp().
*/
APREQ_DECLARE(apr_status_t) apreq_file_mktemp(apr_file_t **fp,
@@ -246,12 +264,13 @@
/**
* Set aside all buckets in the brigade.
+ *
* @param bb Brigade.
* @param p Setaside buckets into this pool.
*/
-static APR_INLINE void
-apreq_brigade_setaside(apr_bucket_brigade *bb, apr_pool_t *p)
+static APR_INLINE
+void apreq_brigade_setaside(apr_bucket_brigade *bb, apr_pool_t *p)
{
apr_bucket *e;
for (e = APR_BRIGADE_FIRST(bb); e != APR_BRIGADE_SENTINEL(bb);
@@ -264,9 +283,11 @@
/**
* Copy a brigade.
+ *
* @param d (destination) Copied buckets are appended to this brigade.
* @param s (source) Brigade to copy from.
- * @remark s == d produces Undefined Behavior.
+ *
+ * @remarks s == d produces Undefined Behavior.
*/
static APR_INLINE
@@ -284,37 +305,47 @@
/**
* Search a header string for the value of a particular named attribute.
+ *
* @param hdr Header string to scan.
* @param name Name of attribute to search for.
* @param nlen Length of name.
* @param val Location of (first) matching value.
* @param vlen Length of matching value.
- * @return APR_SUCCESS if found, otherwise APR_NOTFOUND.
- */
-APREQ_DECLARE(apr_status_t)
- apreq_header_attribute(const char *hdr,
- const char *name, const apr_size_t nlen,
- const char **val, apr_size_t *vlen);
+ *
+ * @return ::APR_SUCCESS.
+ * @return ::APREQ_ERROR_NOATTR if the attribute isn't found.
+ * @return ::APREQ_ERROR_BADTOKEN if the header is unparseable.
+ */
+APREQ_DECLARE(apr_status_t) apreq_header_attribute(const char *hdr,
+ const char *name,
+ const apr_size_t nlen,
+ const char **val,
+ apr_size_t *vlen);
/**
* Concatenates the brigades, spooling large brigades into
* a tempfile bucket according to the environment's max_brigade
* setting- see apreq_env_max_brigade().
+ *
* @param pool Pool for creating a tempfile bucket.
* @param temp_dir Directory for tempfile creation.
* @param brigade_limit If out's length would exceed this value,
* the appended buckets get written to a tempfile.
* @param out Resulting brigade.
* @param in Brigade to append.
- * @return APR_SUCCESS on success, error code otherwise.
+ *
+ * @return ::APR_SUCCESS.
+ * @return XXX error code resulting from apr_brigade_length().
+ * @return XXX error code resulting from apreq_file_mktemp().
+ * @return XXX error code resulting from apreq_brigade_fwrite().
+ * @return XXX error code resulting from apr_file_seek().
*/
APREQ_DECLARE(apr_status_t) apreq_brigade_concat(apr_pool_t *pool,
const char *temp_dir,
apr_size_t brigade_limit,
apr_bucket_brigade *out,
apr_bucket_brigade *in);
-
#ifdef __cplusplus
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/cookie.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/cookie.c Sun Feb 20
09:00:30 2005
@@ -46,10 +46,12 @@
}
}
-APREQ_DECLARE(apr_status_t)
- apreq_cookie_attr(apr_pool_t *p, apreq_cookie_t *c,
- const char *attr, apr_size_t alen,
- const char *val, apr_size_t vlen)
+APREQ_DECLARE(apr_status_t) apreq_cookie_attr(apr_pool_t *p,
+ apreq_cookie_t *c,
+ const char *attr,
+ apr_size_t alen,
+ const char *val,
+ apr_size_t vlen)
{
if (alen < 2)
return APR_EBADARG;
@@ -122,8 +124,10 @@
}
APREQ_DECLARE(apreq_cookie_t *) apreq_cookie_make(apr_pool_t *p,
- const char *name, const apr_size_t nlen,
- const char *value, const apr_size_t vlen)
+ const char *name,
+ const apr_size_t nlen,
+ const char *value,
+ const apr_size_t vlen)
{
apreq_cookie_t *c;
apreq_value_t *v;
@@ -158,10 +162,10 @@
return c;
}
-APR_INLINE
-static apr_status_t get_pair(apr_pool_t *p, const char **data,
- const char **n, apr_size_t *nlen,
- const char **v, apr_size_t *vlen, unsigned
unquote)
+static APR_INLINE
+apr_status_t get_pair(apr_pool_t *p, const char **data,
+ const char **n, apr_size_t *nlen,
+ const char **v, apr_size_t *vlen, unsigned unquote)
{
const char *hdr, *key, *val;
@@ -317,7 +321,7 @@
return APREQ_ERROR_BADSEQ;
}
else if (version == NETSCAPE) {
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_MISMATCH;
}
++hdr;
@@ -350,7 +354,7 @@
if (status != APR_SUCCESS)
return status;
- c = apreq_make_cookie(p, name, nlen, value, vlen);
+ c = apreq_cookie_make(p, name, nlen, value, vlen);
APREQ_FLAGS_ON(c->flags, APREQ_TAINT);
if (version != NETSCAPE)
apreq_cookie_version_set(c, version);
Modified: 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=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/error.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/error.c Sun Feb 20 09:00:30
2005
@@ -30,11 +30,20 @@
{
switch (statcode) {
+
+/* 0's: generic error status codes */
+
case APREQ_ERROR_GENERAL:
return "Internal apreq error";
- case APREQ_ERROR_NODATA:
- return "Missing input data";
+ case APREQ_ERROR_TAINTED:
+ return "Attempt to perform unsafe action with tainted data";
+
+
+/* 10's: malformed input */
+
+ case APREQ_ERROR_BADDATA:
+ return "Malformed input data";
case APREQ_ERROR_BADSEQ:
return "Invalid byte sequence";
@@ -42,23 +51,45 @@
case APREQ_ERROR_BADCHAR:
return "Invalid character";
+ case APREQ_ERROR_NOTOKEN:
+ return "Expected token not present";
+
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";
+
+/* 20's: missing input */
+
+ case APREQ_ERROR_NODATA:
+ return "Missing input data";
+
+ case APREQ_ERROR_NOATTR:
+ return "Missing attribute";
+
+ case APREQ_ERROR_NOHEADER:
+ return "Missing header";
+
case APREQ_ERROR_NOPARSER:
- return "Parser not found";
+ return "Missing parser";
+
+
+/* 30's: configuration conflicts */
+
+ case APREQ_ERROR_MISMATCH:
+ return "Conflicting information";
+
+ case APREQ_ERROR_OVERLIMIT:
+ return "Exceeds configured limit";
+
+ case APREQ_ERROR_NOTEMPTY:
+ return "Setting already configured";
- case APREQ_ERROR_TAINTED:
- return "Attempt to perform unsafe action with tainted data";
default:
return "Error string not yet specified by apreq";
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/module.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/module.c Sun Feb 20
09:00:30 2005
@@ -79,7 +79,7 @@
len = apreq_cookie_serialize(c, s, APREQ_COOKIE_MAX_LENGTH);
if (apreq_cookie_version(c) == 0)
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_MISMATCH;
if (len >= APREQ_COOKIE_MAX_LENGTH)
return APREQ_ERROR_OVERLIMIT;
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/module_cgi.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/module_cgi.c Sun Feb 20
09:00:30 2005
@@ -531,7 +531,7 @@
return APR_SUCCESS;
}
else
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_MISMATCH;
}
@@ -569,7 +569,7 @@
return APR_SUCCESS;
}
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_MISMATCH;
}
static apr_status_t cgi_brigade_limit_get(apreq_handle_t *env,
@@ -593,7 +593,7 @@
return APR_SUCCESS;
}
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_MISMATCH;
}
@@ -621,7 +621,7 @@
return APR_SUCCESS;
}
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_MISMATCH;
}
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/param.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/param.c Sun Feb 20 09:00:30
2005
@@ -25,9 +25,9 @@
#define MAX_READ_AHEAD (1024 * 64)
APREQ_DECLARE(apreq_param_t *) apreq_param_make(apr_pool_t *p,
- const char *name,
+ const char *name,
const apr_size_t nlen,
- const char *val,
+ const char *val,
const apr_size_t vlen)
{
apreq_param_t *param = apr_palloc(p, nlen + vlen + 1 + sizeof *param);
@@ -51,9 +51,9 @@
APREQ_DECLARE(apr_status_t) apreq_param_decode(apreq_param_t **param,
- apr_pool_t *pool,
+ apr_pool_t *pool,
const char *word,
- const apr_size_t nlen,
+ const apr_size_t nlen,
const apr_size_t vlen)
{
apr_status_t status;
@@ -87,7 +87,7 @@
}
-APREQ_DECLARE(char *) apreq_param_encode(apr_pool_t *pool,
+APREQ_DECLARE(char *) apreq_param_encode(apr_pool_t *pool,
const apreq_param_t *param)
{
apreq_value_t *v;
@@ -239,5 +239,3 @@
apr_table_do(upload_set, ¶m, body, name, NULL);
return param;
}
-
-
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=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/parser.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/parser.c Sun Feb 20
09:00:30 2005
@@ -30,19 +30,18 @@
return APR_INCOMPLETE; \
} while (0);
-APREQ_DECLARE(apreq_parser_t *)
- apreq_parser_make(apr_pool_t *pool,
- apr_bucket_alloc_t *ba,
- const char *content_type,
- apreq_parser_function_t parser,
- apr_size_t brigade_limit,
- const char *temp_dir,
- apreq_hook_t *hook,
- void *ctx)
+APREQ_DECLARE(apreq_parser_t *) apreq_parser_make(apr_pool_t *pool,
+ apr_bucket_alloc_t *ba,
+ const char *content_type,
+ apreq_parser_function_t pfn,
+ apr_size_t brigade_limit,
+ const char *temp_dir,
+ apreq_hook_t *hook,
+ void *ctx)
{
apreq_parser_t *p = apr_palloc(pool, sizeof *p);
p->content_type = content_type;
- p->parser = parser;
+ p->parser = pfn;
p->hook = hook;
p->pool = pool;
p->bucket_alloc = ba;
@@ -52,11 +51,10 @@
return p;
}
-APREQ_DECLARE(apreq_hook_t *)
- apreq_hook_make(apr_pool_t *pool,
- apreq_hook_function_t hook,
- apreq_hook_t *next,
- void *ctx)
+APREQ_DECLARE(apreq_hook_t *) apreq_hook_make(apr_pool_t *pool,
+ apreq_hook_function_t hook,
+ apreq_hook_t *next,
+ void *ctx)
{
apreq_hook_t *h = apr_palloc(pool, sizeof *h);
h->hook = hook;
@@ -129,7 +127,7 @@
}
APREQ_DECLARE(apr_status_t) apreq_register_parser(const char *enctype,
- apreq_parser_function_t
parser)
+ apreq_parser_function_t pfn)
{
apr_status_t status;
apreq_parser_function_t *f = NULL;
@@ -144,9 +142,9 @@
if (status != APR_SUCCESS)
return status;
- if (parser != NULL) {
+ if (pfn != NULL) {
f = apr_palloc(default_parser_pool, sizeof *f);
- *f = parser;
+ *f = pfn;
}
apr_hash_set(default_parsers, apr_pstrdup(default_parser_pool, enctype),
APR_HASH_KEY_STRING, f);
@@ -155,6 +153,7 @@
return APR_SUCCESS;
}
+
APREQ_DECLARE(apreq_parser_function_t)apreq_parser(const char *enctype)
{
apr_status_t status;
Modified: httpd/apreq/branches/multi-env-unstable/library/parser_header.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/parser_header.c?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/parser_header.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/parser_header.c Sun Feb 20
09:00:30 2005
@@ -1,3 +1,19 @@
+/*
+** 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.
+*/
+
#include "apreq_parser.h"
#include "apreq_error.h"
#include "apreq_util.h"
Modified: httpd/apreq/branches/multi-env-unstable/library/parser_multipart.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/parser_multipart.c?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/parser_multipart.c
(original)
+++ httpd/apreq/branches/multi-env-unstable/library/parser_multipart.c Sun Feb
20 09:00:30 2005
@@ -1,3 +1,19 @@
+/*
+** 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.
+*/
+
#include "apreq_parser.h"
#include "apreq_error.h"
#include "apreq_util.h"
Modified: httpd/apreq/branches/multi-env-unstable/library/parser_urlencoded.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/parser_urlencoded.c?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/parser_urlencoded.c
(original)
+++ httpd/apreq/branches/multi-env-unstable/library/parser_urlencoded.c Sun Feb
20 09:00:30 2005
@@ -1,3 +1,18 @@
+/*
+** 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.
+*/
#include "apreq_parser.h"
#include "apreq_util.h"
#include "apreq_error.h"
Propchange: httpd/apreq/branches/multi-env-unstable/library/t/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Feb 20 09:00:30 2005
@@ -14,3 +14,5 @@
version
error.t
error
+util.t
+util
Modified: httpd/apreq/branches/multi-env-unstable/library/t/Makefile.am
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/t/Makefile.am?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/Makefile.am (original)
+++ httpd/apreq/branches/multi-env-unstable/library/t/Makefile.am Sun Feb 20
09:00:30 2005
@@ -5,10 +5,10 @@
noinst_LIBRARIES = libapache_test.a
libapache_test_a_SOURCES = at.h at.c
-check_PROGRAMS = version cookie params parsers error
+check_PROGRAMS = version cookie params parsers error util
LDADD = libapache_test.a
-check_SCRIPTS = version.t cookie.t params.t parsers.t error.t
+check_SCRIPTS = version.t cookie.t params.t parsers.t error.t util.t
TESTS = $(check_SCRIPTS)
TESTS_ENVIRONMENT = @PERL@ -MTest::Harness -e 'runtests(@ARGV)'
CLEANFILES = $(check_SCRIPTS)
Modified: httpd/apreq/branches/multi-env-unstable/library/t/at.h
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/t/at.h?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/at.h (original)
+++ httpd/apreq/branches/multi-env-unstable/library/t/at.h Sun Feb 20 09:00:30
2005
@@ -39,8 +39,8 @@
at_test_function_t func;
int plan;
const char *fatals;
- const char *todos;
const char *skips;
+ const char *todos;
};
struct at_report_t {
@@ -63,8 +63,8 @@
const char *name; /* name of current test */
int plan; /* total # of checks in this test */
const int *fatal; /* list of unrecoverables */
- const int *todo; /* list of expected failures */
const int *skip; /* list of ignorabe assertions */
+ const int *todo; /* list of expected failures */
at_report_t *report ;/* handles the results of each check */
unsigned char flags; /* verbosity: concise, trace, debug, etc. */
apr_pool_t *pool; /* creator pool with end-of-test cleanup */
Modified: httpd/apreq/branches/multi-env-unstable/library/t/cookie.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/t/cookie.c?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/cookie.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/t/cookie.c Sun Feb 20
09:00:30 2005
@@ -75,6 +75,7 @@
static void netscape_cookie(dAT)
{
+ char expires[APR_RFC822_DATE_LEN];
char *val;
apreq_cookie_t *c;
@@ -83,7 +84,7 @@
c = apreq_value_to_cookie(val);
- AT_str_eq(apreq_cookie_value(c), "bar");
+ AT_str_eq(c->v.data, "bar");
AT_int_eq(apreq_cookie_version(c), 0);
AT_str_eq(apreq_cookie_as_string(c, p), "foo=bar");
@@ -95,19 +96,24 @@
"foo=bar; path=/quux; domain=example.com");
apreq_cookie_expires(c, "+1y");
+ apr_rfc822_date(expires, apr_time_now()
+ + apr_time_from_sec(apreq_atoi64t("+1y")));
+ expires[7] = '-';
+ expires[11] = '-';
val = apr_pstrcat(p, "foo=bar; path=/quux; domain=example.com; expires=",
- apreq_expires(p, "+1y", APREQ_EXPIRES_NSCOOKIE), NULL);
+ expires, NULL);
+
AT_str_eq(apreq_cookie_as_string(c, p), val);
}
static void rfc_cookie(dAT)
{
- apreq_cookie_t *c = apreq_make_cookie(p,"rfc",3,"out",3);
+ apreq_cookie_t *c = apreq_cookie_make(p,"rfc",3,"out",3);
const char *expected;
long expires;
- AT_str_eq(apreq_cookie_value(c), "out");
+ AT_str_eq(c->v.data, "out");
apreq_cookie_version_set(c, 1);
AT_int_eq(apreq_cookie_version(c), 1);
Modified: httpd/apreq/branches/multi-env-unstable/library/t/error.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/t/error.c?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/error.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/t/error.c Sun Feb 20
09:00:30 2005
@@ -27,28 +27,33 @@
AT_ptr_eq(str, buf);
AT_str_eq(str, "Internal apreq error");
- str = apreq_strerror(APR_EGENERAL, buf, sizeof buf);
- AT_ptr_eq(str, buf);
- AT_str_eq(str, "Internal error");
-
- str = apreq_strerror(APREQ_ERROR_NODATA, buf, sizeof buf);
- AT_str_eq(str, "Missing input data");
+ str = apreq_strerror(APREQ_ERROR_TAINTED, buf, sizeof buf);
+ AT_str_eq(str, "Attempt to perform unsafe action with tainted data");
str = apreq_strerror(APREQ_ERROR_BADSEQ, buf, sizeof buf);
AT_str_eq(str, "Invalid byte sequence");
- str = apreq_strerror(APREQ_ERROR_TAINTED, buf, sizeof buf);
- AT_str_eq(str, "Attempt to perform unsafe action with tainted data");
+ str = apreq_strerror(APREQ_ERROR_NODATA, buf, sizeof buf);
+ AT_str_eq(str, "Missing input data");
str = apreq_strerror(APREQ_ERROR_GENERAL+99, buf, sizeof buf);
AT_str_eq(str, "Error string not yet specified by apreq");
+
+
+
+ /* Test some common APR status codes also */
+
+ str = apreq_strerror(APR_EGENERAL, buf, sizeof buf);
+ AT_ptr_eq(str, buf);
+ AT_str_eq(str, "Internal error");
+
str = apreq_strerror(APR_SUCCESS, buf, sizeof buf);
AT_str_eq(str, "Success");
str = apreq_strerror(APR_EINIT, buf, sizeof buf);
- AT_str_eq(str, "There is no error, this value signifies an initialized "
- "error code");
+ AT_str_eq(str, "There is no error, this value signifies an initialized "
+ "error code");
str = apreq_strerror(APR_INCOMPLETE, buf, sizeof buf);
AT_str_eq(str, "Partial results are valid but processing is incomplete");
@@ -70,7 +75,7 @@
apr_pool_t *p;
dAT;
at_test_t test_list [] = {
- { dT(test_strerror, 13) }
+ { dT(test_strerror, 13), "1" }
};
apr_initialize();
Modified: httpd/apreq/branches/multi-env-unstable/library/t/params.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/t/params.c?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/params.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/t/params.c Sun Feb 20
09:00:30 2005
@@ -104,10 +104,10 @@
apr_status_t s;
s = apreq_header_attribute(hdr, "none", 4, &val, &vlen);
- AT_int_eq(s, APR_NOTFOUND);
+ AT_int_eq(s, APREQ_ERROR_NOATTR);
s = apreq_header_attribute(hdr, "set", 3, &val, &vlen);
- AT_int_eq(s, APR_NOTFOUND);
+ AT_int_eq(s, APREQ_ERROR_NOATTR);
s = apreq_header_attribute(hdr, "boundary", 8, &val, &vlen);
AT_int_eq(s, APR_SUCCESS);
Added: httpd/apreq/branches/multi-env-unstable/library/t/util.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/t/util.c?view=auto&rev=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/util.c (added)
+++ httpd/apreq/branches/multi-env-unstable/library/t/util.c Sun Feb 20
09:00:30 2005
@@ -0,0 +1,171 @@
+/*
+** Copyright 2004-2005 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 "apr_strings.h"
+#include "apreq_error.h"
+#include "apreq_util.h"
+#include "at.h"
+
+static void test_atoi64f(dAT)
+{
+ AT_int_eq(apreq_atoi64f("0"), 0);
+ AT_int_eq(apreq_atoi64f("-1"), -1);
+ AT_int_eq(apreq_atoi64f("-"), 0);
+ AT_int_eq(apreq_atoi64f("5"), 5);
+ AT_int_eq(apreq_atoi64f("3.333"), 3);
+ AT_int_eq(apreq_atoi64f("33k"), 33 * 1024);
+ AT_int_eq(apreq_atoi64f(" +8M "), 8 * 1024 * 1024);
+ AT_ok(apreq_atoi64f("44GB") == (apr_int64_t)44 * 1024 * 1024 * 1024,
+ "44GB test");
+ AT_ok(apreq_atoi64f("0xaBcDefg") == (apr_int64_t)11259375 * 1024 * 1024 *
1024,
+ "hex test");
+}
+
+static void test_atoi64t(dAT)
+{
+ AT_int_eq(apreq_atoi64t("0"), 0);
+ AT_int_eq(apreq_atoi64t("-1"), -1);
+ AT_int_eq(apreq_atoi64t("-g088l3dyg00k"), 0);
+ AT_int_eq(apreq_atoi64t("5s"), 5);
+ AT_int_eq(apreq_atoi64t("3.333"), 3);
+ AT_int_eq(apreq_atoi64t("33d"), 33 * 60 * 60 * 24);
+ AT_int_eq(apreq_atoi64t(" +8M "), 8 * 60 * 60 * 24 * 30);
+ AT_int_eq(apreq_atoi64t("+9m"), 9 * 60);
+ AT_int_eq(apreq_atoi64t("6h"), 6 * 60 * 60);
+
+}
+
+static void test_index(dAT)
+{
+ const char haystack[] = "Four score and seven years ago";
+ apr_size_t hlen = sizeof haystack - 1;
+ AT_int_eq(apreq_index(haystack, hlen, "Four", 4, APREQ_MATCH_FULL),
+ 0);
+ AT_int_eq(apreq_index(haystack, hlen, "Four", 4, APREQ_MATCH_PARTIAL),
+ 0);
+ AT_int_eq(apreq_index(haystack, hlen, "Fourteen", 8, APREQ_MATCH_FULL),
+ -1);
+ AT_int_eq(apreq_index(haystack, hlen, "Fourteen", 8, APREQ_MATCH_PARTIAL),
+ -1);
+ AT_int_eq(apreq_index(haystack, hlen, "agoraphobia", 11, APREQ_MATCH_FULL),
+ -1);
+ AT_int_eq(apreq_index(haystack, hlen, "agoraphobia", 11,
APREQ_MATCH_PARTIAL),
+ hlen - 3);
+}
+
+static void test_decode(dAT)
+{
+
+
+
+
+
+}
+
+static void test_decodev(dAT)
+{
+
+}
+
+
+static void test_encode(dAT)
+{
+
+}
+
+
+static void test_quote(dAT)
+{
+
+}
+
+static void test_quote_once(dAT)
+{
+
+}
+
+static void test_join(dAT)
+{
+
+}
+
+static void test_brigade_fwrite(dAT)
+{
+
+}
+
+static void test_file_mktemp(dAT)
+{
+
+
+}
+
+static void test_header_attribute(dAT)
+{
+
+
+}
+
+static void test_brigade_concat(dAT)
+{
+
+}
+
+
+
+#define dT(func, plan) #func, func, plan
+
+
+int main(int argc, char *argv[])
+{
+ unsigned i, plan = 0;
+ apr_pool_t *p;
+ dAT;
+ at_test_t test_list [] = {
+ { dT(test_atoi64f, 9) },
+ { dT(test_atoi64t, 9) },
+ { dT(test_index, 6) },
+ { dT(test_decode, 0) },
+ { dT(test_decodev, 0) },
+ { dT(test_encode, 0) },
+ { dT(test_quote, 0) },
+ { dT(test_quote_once, 0), },
+ { dT(test_join, 0) },
+ { dT(test_brigade_fwrite, 0) },
+ { dT(test_file_mktemp, 0) },
+ { dT(test_header_attribute, 0) },
+ { dT(test_brigade_concat, 0) },
+ };
+
+ apr_initialize();
+ atexit(apr_terminate);
+
+ apr_pool_create(&p, NULL);
+
+ AT = at_create(p, 0, at_report_stdout_make(p));
+
+ for (i = 0; i < sizeof(test_list) / sizeof(at_test_t); ++i)
+ plan += test_list[i].plan;
+
+ AT_begin(plan);
+
+ for (i = 0; i < sizeof(test_list) / sizeof(at_test_t); ++i)
+ AT_run(&test_list[i]);
+
+ AT_end();
+
+ return 0;
+}
Modified: httpd/apreq/branches/multi-env-unstable/library/util.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/util.c?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/util.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/util.c Sun Feb 20 09:00:30
2005
@@ -24,33 +24,7 @@
#define MAX(a,b) ( (a) > (b) ? (a) : (b) )
-APREQ_DECLARE(char *) apreq_expires(apr_pool_t *p, const char *time_str,
- const apreq_expires_t type)
-{
- apr_time_t when;
- apr_time_exp_t tms;
- char sep = (type == APREQ_EXPIRES_HTTP) ? ' ' : '-';
-
- if (time_str == NULL) {
- return NULL;
- }
-
- when = apr_time_now();
- if (strcasecmp(time_str,"now"))
- when += apr_time_from_sec(apreq_atoi64t(time_str));
-
- if ( apr_time_exp_gmt(&tms, when) != APR_SUCCESS )
- return NULL;
-
- return apr_psprintf(p,
- "%s, %.2d%c%s%c%.2d %.2d:%.2d:%.2d GMT",
- apr_day_snames[tms.tm_wday],
- tms.tm_mday, sep, apr_month_snames[tms.tm_mon], sep,
- tms.tm_year + 1900,
- tms.tm_hour, tms.tm_min, tms.tm_sec);
-}
-
-/* used for specifying file & byte sizes */
+/* used for specifying file sizes */
APREQ_DECLARE(apr_int64_t) apreq_atoi64f(const char *s)
{
@@ -420,10 +394,10 @@
}
-APREQ_DECLARE(const char *) apreq_join(apr_pool_t *p,
- const char *sep,
- const apr_array_header_t *arr,
- apreq_join_t mode)
+APREQ_DECLARE(char *) apreq_join(apr_pool_t *p,
+ const char *sep,
+ const apr_array_header_t *arr,
+ apreq_join_t mode)
{
apr_ssize_t len, slen;
apreq_value_t *rv;
@@ -757,7 +731,7 @@
hdr = v;
}
- return APR_NOTFOUND;
+ return APREQ_ERROR_NOATTR;
}
Modified: httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c?view=diff&r1=154526&r2=154527
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c (original)
+++ httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c Sun Feb 20
09:00:30 2005
@@ -229,7 +229,7 @@
return APR_SUCCESS;
}
else
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_NOTEMPTY;
}
@@ -279,7 +279,7 @@
return APR_SUCCESS;
}
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_MISMATCH;
}
static
@@ -314,7 +314,7 @@
return APR_SUCCESS;
}
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_MISMATCH;
}
static
@@ -350,7 +350,7 @@
return APR_SUCCESS;
}
- return APREQ_ERROR_CONFLICT;
+ return APREQ_ERROR_NOTEMPTY;
}
static