You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2005/02/18 23:07:47 UTC
svn commit: r154358 [2/2] - in httpd/apreq/branches/multi-env-unstable: ./
build/ glue/perl/ glue/perl/t/api/ glue/perl/t/apreq/
glue/perl/t/response/TestAPI/ glue/perl/xsbuilder/
glue/perl/xsbuilder/APR/Request/ glue/perl/xsbuilder/APR/Request/Apache2/
glue/perl/xsbuilder/APR/Request/Cookie/
glue/perl/xsbuilder/APR/Request/Param/ glue/perl/xsbuilder/maps/ include/
library/ library/t/ module/ module/apache2/
module/t/c-modules/apreq_cookie_test/
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=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/parser_header.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/parser_header.c Fri Feb 18 14:07:36 2005
@@ -1,4 +1,6 @@
#include "apreq_parser.h"
+#include "apreq_error.h"
+#include "apreq_util.h"
#define PARSER_STATUS_CHECK(PREFIX) do { \
if (ctx->status == PREFIX##_ERROR) \
@@ -40,14 +42,8 @@
if (nlen == 0)
return APR_EBADARG;
- param = apr_palloc(pool, nlen + vlen + sizeof *param);
- param->upload = NULL;
- param->info = NULL;
-
+ param = apreq_param_make(pool, NULL, nlen, NULL, vlen);
*(const apreq_value_t **)&v = ¶m->v;
- v->name = v->data + vlen; /* no +1, since vlen includes extra (CR)LF */
-
- /* copy name */
off = 0;
while (off < nlen) {
@@ -120,7 +116,7 @@
v->size--;
v->data[v->size] = 0;
-
+ APREQ_FLAGS_ON(param->flags, APREQ_TAINT);
*p = param;
return APR_SUCCESS;
@@ -271,7 +267,7 @@
apr_bucket_split(e, off);
s = split_header_line(¶m, pool, ctx->bb, nlen, glen, vlen);
if (parser->hook != NULL && s == APR_SUCCESS)
- s = apreq_run_hook(parser->hook, param, NULL);
+ s = apreq_hook_run(parser->hook, param, NULL);
if (s != APR_SUCCESS) {
ctx->status = HDR_ERROR;
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=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/parser_multipart.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/parser_multipart.c Fri Feb 18 14:07:36 2005
@@ -1,4 +1,6 @@
#include "apreq_parser.h"
+#include "apreq_error.h"
+#include "apreq_util.h"
#include "apr_strings.h"
#include "apr_strmatch.h"
@@ -214,7 +216,7 @@
ctx->status = MFD_INIT;
ctx->pattern = apr_strmatch_precompile(pool, ctx->bdry, 1);
- ctx->hdr_parser = apreq_make_parser(pool, ba, "", apreq_parse_headers,
+ ctx->hdr_parser = apreq_parser_make(pool, ba, "", apreq_parse_headers,
brigade_limit, temp_dir, NULL, NULL);
ctx->info = NULL;
ctx->bb = apr_brigade_create(pool, ba);
@@ -243,7 +245,7 @@
return APR_EGENERAL;
- ctx->mix_parser = apreq_make_parser(pool, ba, "",
+ ctx->mix_parser = apreq_parser_make(pool, ba, "",
apreq_parse_multipart,
parser->brigade_limit,
parser->temp_dir,
@@ -304,7 +306,7 @@
/* flush out old header parser internal structs for reuse */
ctx->hdr_parser->ctx = NULL;
}
- s = apreq_run_parser(ctx->hdr_parser, ctx->info, ctx->in);
+ s = apreq_parser_run(ctx->hdr_parser, ctx->info, ctx->in);
switch (s) {
case APR_SUCCESS:
ctx->status = MFD_POST_HEADER;
@@ -398,8 +400,9 @@
else {
apreq_param_t *param;
- param = apreq_make_param(pool, name, nlen,
+ param = apreq_param_make(pool, name, nlen,
filename, flen);
+ APREQ_FLAGS_ON(param->flags, APREQ_TAINT);
param->info = ctx->info;
param->upload = apr_brigade_create(pool,
ctx->bb->bucket_alloc);
@@ -420,8 +423,9 @@
apreq_param_t *param;
name = ctx->param_name;
nlen = strlen(name);
- param = apreq_make_param(pool, name, nlen,
+ param = apreq_param_make(pool, name, nlen,
filename, flen);
+ APREQ_FLAGS_ON(param->flags, APREQ_TAINT);
param->info = ctx->info;
param->upload = apr_brigade_create(pool,
ctx->bb->bucket_alloc);
@@ -443,8 +447,9 @@
nlen = strlen(name);
filename = "";
flen = 0;
- param = apreq_make_param(pool, name, nlen,
+ param = apreq_param_make(pool, name, nlen,
filename, flen);
+ APREQ_FLAGS_ON(param->flags, APREQ_TAINT);
param->info = ctx->info;
param->upload = apr_brigade_create(pool,
ctx->bb->bucket_alloc);
@@ -479,8 +484,8 @@
return s;
}
len = off;
- param = apr_palloc(pool, len + sizeof *param);
- param->upload = NULL;
+ param = apreq_param_make(pool, NULL, 0, NULL, len);
+ APREQ_FLAGS_ON(param->flags, APREQ_TAINT);
param->info = ctx->info;
*(const apreq_value_t **)&v = ¶m->v;
@@ -490,7 +495,7 @@
v->data[v->size] = 0;
if (parser->hook != NULL) {
- s = apreq_run_hook(parser->hook, param, NULL);
+ s = apreq_hook_run(parser->hook, param, NULL);
if (s != APR_SUCCESS) {
ctx->status = MFD_ERROR;
return s;
@@ -521,7 +526,7 @@
case APR_INCOMPLETE:
if (parser->hook != NULL) {
- s = apreq_run_hook(parser->hook, param, ctx->bb);
+ s = apreq_hook_run(parser->hook, param, ctx->bb);
if (s != APR_SUCCESS) {
ctx->status = MFD_ERROR;
return s;
@@ -536,7 +541,7 @@
case APR_SUCCESS:
if (parser->hook != NULL) {
APR_BRIGADE_INSERT_TAIL(ctx->bb, ctx->eos);
- s = apreq_run_hook(parser->hook, param, ctx->bb);
+ s = apreq_hook_run(parser->hook, param, ctx->bb);
APR_BUCKET_REMOVE(ctx->eos);
if (s != APR_SUCCESS) {
ctx->status = MFD_ERROR;
@@ -565,7 +570,7 @@
case MFD_MIXED:
{
- s = apreq_run_parser(ctx->mix_parser, t, ctx->in);
+ s = apreq_parser_run(ctx->mix_parser, t, ctx->in);
switch (s) {
case APR_SUCCESS:
ctx->status = MFD_INIT;
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=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/parser_urlencoded.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/parser_urlencoded.c Fri Feb 18 14:07:36 2005
@@ -1,4 +1,6 @@
#include "apreq_parser.h"
+#include "apreq_util.h"
+#include "apreq_error.h"
#define PARSER_STATUS_CHECK(PREFIX) do { \
if (ctx->status == PREFIX##_ERROR) \
@@ -26,8 +28,8 @@
static apr_status_t split_urlword(apreq_param_t **p, apr_pool_t *pool,
apr_bucket_brigade *bb,
- const apr_size_t nlen,
- const apr_size_t vlen)
+ apr_size_t nlen,
+ apr_size_t vlen)
{
apreq_param_t *param;
apreq_value_t *v;
@@ -39,7 +41,7 @@
if (nlen == 0)
return APR_EBADARG;
- param = apr_palloc(pool, nlen + vlen + 1 + sizeof *param);
+ param = apreq_param_make(pool, NULL, nlen, NULL, vlen);
*(const apreq_value_t **)&v = ¶m->v;
arr.pool = pool;
@@ -48,11 +50,6 @@
arr.nalloc = APREQ_DEFAULT_NELTS;
arr.elts = (char *)vec;
- param->upload = NULL;
- param->info = NULL;
-
- v->name = v->data + vlen + 1;
-
apr_brigade_partition(bb, nlen+1, &end);
for (e = APR_BRIGADE_FIRST(bb); e != end; e = APR_BUCKET_NEXT(e)) {
@@ -67,7 +64,7 @@
((struct iovec *)arr.elts)[arr.nelts - 1].iov_len--; /* drop '=' sign */
- s = apreq_decodev(v->name, &v->size,
+ s = apreq_decodev(v->name, &nlen,
(struct iovec *)arr.elts, arr.nelts);
if (s != APR_SUCCESS)
return s;
@@ -91,7 +88,7 @@
if (end != APR_BRIGADE_SENTINEL(bb))
((struct iovec *)arr.elts)[arr.nelts - 1].iov_len--; /* drop [&;] */
- s = apreq_decodev(v->data, &v->size,
+ s = apreq_decodev(v->data, &vlen,
(struct iovec *)arr.elts, arr.nelts);
if (s != APR_SUCCESS)
@@ -100,6 +97,7 @@
while ((e = APR_BRIGADE_FIRST(bb)) != end)
apr_bucket_delete(e);
+ APREQ_FLAGS_ON(param->flags, APREQ_TAINT);
*p = param;
return APR_SUCCESS;
}
@@ -143,7 +141,7 @@
else {
s = split_urlword(¶m, pool, ctx->bb, nlen, vlen);
if (parser->hook != NULL && s == APR_SUCCESS)
- s = apreq_run_hook(parser->hook, param, NULL);
+ s = apreq_hook_run(parser->hook, param, NULL);
if (s == APR_SUCCESS) {
apr_table_addn(t, param->v.name, param->v.data);
@@ -188,7 +186,7 @@
case ';':
s = split_urlword(¶m, pool, ctx->bb, nlen, vlen);
if (parser->hook != NULL && s == APR_SUCCESS)
- s = apreq_run_hook(parser->hook, param, NULL);
+ s = apreq_hook_run(parser->hook, param, NULL);
if (s != APR_SUCCESS) {
ctx->status = URL_ERROR;
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=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/Makefile.am (original)
+++ httpd/apreq/branches/multi-env-unstable/library/t/Makefile.am Fri Feb 18 14:07:36 2005
@@ -5,10 +5,10 @@
noinst_LIBRARIES = libapache_test.a
libapache_test_a_SOURCES = at.h at.c
-check_PROGRAMS = version cookie params parsers
+check_PROGRAMS = version cookie params parsers error
LDADD = libapache_test.a
-check_SCRIPTS = version.t cookie.t params.t parsers.t
+check_SCRIPTS = version.t cookie.t params.t parsers.t error.t
TESTS = $(check_SCRIPTS)
TESTS_ENVIRONMENT = @PERL@ -MTest::Harness -e 'runtests(@ARGV)'
CLEANFILES = $(check_SCRIPTS)
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=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/cookie.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/t/cookie.c Fri Feb 18 14:07:36 2005
@@ -15,7 +15,10 @@
*/
#include "apr_strings.h"
-#include "apreq.h"
+#include "apreq_cookie.h"
+#include "apreq_error.h"
+#include "apreq_module.h"
+#include "apreq_util.h"
#include "at.h"
static const char nscookies[] = "a=1; foo=bar; fl=left; fr=right;bad; "
@@ -81,7 +84,7 @@
c = apreq_value_to_cookie(val);
AT_str_eq(apreq_cookie_value(c), "bar");
- AT_int_eq(c->version, APREQ_COOKIE_VERSION_NETSCAPE);
+ AT_int_eq(apreq_cookie_version(c), 0);
AT_str_eq(apreq_cookie_as_string(c, p), "foo=bar");
c->domain = apr_pstrdup(p, "example.com");
@@ -106,7 +109,8 @@
AT_str_eq(apreq_cookie_value(c), "out");
- c->version = APREQ_COOKIE_VERSION_RFC;
+ apreq_cookie_version_set(c, 1);
+ AT_int_eq(apreq_cookie_version(c), 1);
AT_str_eq(apreq_cookie_as_string(c,p),"rfc=out; Version=1");
c->domain = apr_pstrdup(p, "example.com");
@@ -151,10 +155,10 @@
apreq_handle_t *ns, *rfc;
ns = apreq_handle_custom(p, NULL, NULL, NULL, NULL, 0, NULL);
- AT_int_eq(apreq_ua_cookie_version(ns), APREQ_COOKIE_VERSION_NETSCAPE);
+ AT_int_eq(apreq_ua_cookie_version(ns), 0);
rfc = apreq_handle_custom(p, NULL, NULL, "$Version=\"1\"", NULL, 0, NULL);
- AT_int_eq(apreq_ua_cookie_version(rfc), APREQ_COOKIE_VERSION_RFC);
+ AT_int_eq(apreq_ua_cookie_version(rfc), 1);
}
#define dT(func, plan) #func, func, plan
@@ -169,7 +173,7 @@
{ dT(jar_get_rfc, 6), "1 3 5" },
{ dT(jar_get_ns, 9) },
{ dT(netscape_cookie, 7) },
- { dT(rfc_cookie, 5) },
+ { dT(rfc_cookie, 6) },
{ dT(ua_version, 2) }
};
Added: 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=auto&rev=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/error.c (added)
+++ httpd/apreq/branches/multi-env-unstable/library/t/error.c Fri Feb 18 14:07:36 2005
@@ -0,0 +1,94 @@
+/*
+** 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 "apr_strings.h"
+#include "apreq_error.h"
+#include "at.h"
+
+
+static void test_strerror(dAT)
+{
+ char buf[256], *str;
+
+ str = apreq_strerror(APREQ_ERROR_GENERAL, buf, sizeof buf);
+ 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_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_GENERAL+99, buf, sizeof buf);
+ AT_str_eq(str, "Error string not yet specified by apreq");
+
+ 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");
+
+ str = apreq_strerror(APR_INCOMPLETE, buf, sizeof buf);
+ AT_str_eq(str, "Partial results are valid but processing is incomplete");
+
+ str = apreq_strerror(APR_EOF, buf, sizeof buf);
+ AT_str_eq(str, "End of file found");
+
+ str = apreq_strerror(APR_ENOTIMPL, buf, sizeof buf);
+ AT_str_eq(str, "This function has not been implemented on this platform");
+
+ }
+
+#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_strerror, 13) }
+ };
+
+ 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/t/params.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/t/params.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/params.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/t/params.c Fri Feb 18 14:07:36 2005
@@ -14,7 +14,9 @@
** limitations under the License.
*/
-#include "apreq.h"
+#include "apreq_param.h"
+#include "apreq_util.h"
+#include "apreq_error.h"
#include "apr_strings.h"
#include "at.h"
@@ -132,22 +134,6 @@
}
-static void make_values(dAT)
-{
- apreq_value_t *v;
- apr_size_t len = 4;
- char *name = apr_palloc(p,len);
- char *val = apr_palloc(p,len);
- strcpy(name, "foo");
- strcpy(val, "bar");
-
- v = apreq_make_value(p, name, len, val, len);
- AT_str_eq(v->name, name);
- AT_int_eq(v->size, len);
- AT_str_eq(v->data, val);
-
-}
-
static void make_param(dAT)
{
@@ -160,15 +146,15 @@
strcpy(name, "foo");
strcpy(val, "bar > alpha");
- param = apreq_make_param(p, name, nlen, val, vlen);
+ param = apreq_param_make(p, name, nlen, val, vlen);
AT_str_eq(param->v.name, name);
AT_int_eq(param->v.size, vlen);
AT_str_eq(param->v.data, val);
- encode = apreq_encode_param(p, param);
+ encode = apreq_param_encode(p, param);
AT_str_eq(encode, "foo=bar+%3e+alpha");
- s = apreq_decode_param(&decode, p, encode, nlen, vlen+2);
+ s = apreq_param_decode(&decode, p, encode, nlen, vlen+2);
AT_int_eq(s, APR_SUCCESS);
AT_str_eq(decode->v.name, name);
AT_int_eq(decode->v.size, vlen);
@@ -215,10 +201,8 @@
dT(params_as, 2),
dT(string_decoding_in_place, 8),
dT(header_attributes, 13),
- dT(make_values, 3),
dT(make_param, 8),
dT(quote_strings, 24),
-// dT(test_memmem, 7),
};
apr_initialize();
Modified: httpd/apreq/branches/multi-env-unstable/library/t/parsers.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/t/parsers.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/t/parsers.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/t/parsers.c Fri Feb 18 14:07:36 2005
@@ -14,7 +14,8 @@
** limitations under the License.
*/
-#include "apreq.h"
+#include "apreq_parser.h"
+#include "apreq_error.h"
#include "apr_strings.h"
#include "apr_xml.h"
#include "at.h"
@@ -133,14 +134,14 @@
body = apr_table_make(p, APREQ_DEFAULT_NELTS);
ba = apr_bucket_alloc_create(p);
bb = apr_brigade_create(p, ba);
- parser = apreq_make_parser(p, ba, URL_ENCTYPE, apreq_parse_urlencoded,
+ parser = apreq_parser_make(p, ba, URL_ENCTYPE, apreq_parse_urlencoded,
100, NULL, NULL, NULL);
APR_BRIGADE_INSERT_HEAD(bb,
apr_bucket_immortal_create(url_data,strlen(url_data),
bb->bucket_alloc));
- rv = apreq_run_parser(parser, body, bb);
+ rv = apreq_parser_run(parser, body, bb);
AT_int_eq(rv, APR_INCOMPLETE);
APR_BRIGADE_INSERT_HEAD(bb,
@@ -149,7 +150,7 @@
APR_BRIGADE_INSERT_TAIL(bb,
apr_bucket_eos_create(bb->bucket_alloc));
- rv = apreq_run_parser(parser, body, bb);
+ rv = apreq_parser_run(parser, body, bb);
AT_int_eq(rv, APR_SUCCESS);
AT_str_eq(apr_table_get(body,"alpha"), "one");
@@ -188,7 +189,7 @@
bb = apr_brigade_create(p, ba);
body = apr_table_make(p, APREQ_DEFAULT_NELTS);
- parser = apreq_make_parser(p, ba, MFD_ENCTYPE
+ parser = apreq_parser_make(p, ba, MFD_ENCTYPE
"; charset=\"iso-8859-1\""
"; boundary=\"AaB03x\"",
apreq_parse_multipart,
@@ -209,9 +210,9 @@
apr_bucket_split(f, i - j);
tail = apr_brigade_split(bb, f);
- rv = apreq_run_parser(parser, body, bb);
+ rv = apreq_parser_run(parser, body, bb);
AT_int_eq(rv, (j < strlen(form_data)) ? APR_INCOMPLETE : APR_SUCCESS);
- rv = apreq_run_parser(parser, body, tail);
+ rv = apreq_parser_run(parser, body, tail);
AT_int_eq(rv, APR_SUCCESS);
AT_int_eq(apr_table_elts(body)->nelts, 2);
@@ -258,16 +259,16 @@
APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_eos_create(bb->bucket_alloc));
body = apr_table_make(p, APREQ_DEFAULT_NELTS);
- hook = apreq_make_hook(p, apreq_hook_disable_uploads, NULL, NULL);
+ hook = apreq_hook_make(p, apreq_hook_disable_uploads, NULL, NULL);
- parser = apreq_make_parser(p, ba, MFD_ENCTYPE
+ parser = apreq_parser_make(p, ba, MFD_ENCTYPE
"; charset=\"iso-8859-1\""
"; boundary=\"AaB03x\"",
apreq_parse_multipart,
1000, NULL, hook, NULL);
- rv = apreq_run_parser(parser, body, bb);
+ rv = apreq_parser_run(parser, body, bb);
AT_int_eq(rv, APR_EGENERAL);
AT_int_eq(apr_table_elts(body)->nelts, 1);
@@ -301,10 +302,10 @@
body = apr_table_make(p, APREQ_DEFAULT_NELTS);
- parser = apreq_make_parser(p, ba, "application/xml",
+ parser = apreq_parser_make(p, ba, "application/xml",
apreq_parse_generic, 1000, NULL, NULL, NULL);
- rv = apreq_run_parser(parser, body, bb);
+ rv = apreq_parser_run(parser, body, bb);
AT_int_eq(rv, APR_SUCCESS);
dummy = *(apreq_param_t **)parser->ctx;
AT_not_null(dummy);
@@ -332,12 +333,12 @@
body = apr_table_make(p, APREQ_DEFAULT_NELTS);
- hook = apreq_make_hook(p, apreq_hook_discard_brigade, NULL, NULL);
- parser = apreq_make_parser(p, ba, "application/xml",
+ hook = apreq_hook_make(p, apreq_hook_discard_brigade, NULL, NULL);
+ parser = apreq_parser_make(p, ba, "application/xml",
apreq_parse_generic, 1000, NULL, hook, NULL);
- rv = apreq_run_parser(parser, body, bb);
+ rv = apreq_parser_run(parser, body, bb);
AT_int_eq(rv, APR_SUCCESS);
dummy = *(apreq_param_t **)parser->ctx;
AT_not_null(dummy);
@@ -370,13 +371,13 @@
APR_BRIGADE_INSERT_HEAD(bb, e);
APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_eos_create(bb->bucket_alloc));
- xml_hook = apreq_make_hook(p, apreq_hook_apr_xml_parser, NULL, NULL);
+ xml_hook = apreq_hook_make(p, apreq_hook_apr_xml_parser, NULL, NULL);
body = apr_table_make(p, APREQ_DEFAULT_NELTS);
- parser = apreq_make_parser(p, ba, ct, apreq_parse_multipart,
+ parser = apreq_parser_make(p, ba, ct, apreq_parse_multipart,
1000, NULL, xml_hook, NULL);
- rv = apreq_run_parser(parser, body, bb);
+ rv = apreq_parser_run(parser, body, bb);
AT_int_eq(rv, APR_SUCCESS);
val = apr_table_get(body, "<98...@example.com>");
@@ -445,10 +446,10 @@
APR_BRIGADE_INSERT_HEAD(bb, e);
APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_eos_create(bb->bucket_alloc));
- parser = apreq_make_parser(p, ba, ct, apreq_parse_multipart,
+ parser = apreq_parser_make(p, ba, ct, apreq_parse_multipart,
1000, NULL, NULL, NULL);
- rv = apreq_run_parser(parser, body, bb);
+ rv = apreq_parser_run(parser, body, bb);
AT_int_eq(rv, APR_SUCCESS);
val = apr_table_get(body, "submit-name");
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=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/util.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/util.c Fri Feb 18 14:07:36 2005
@@ -15,34 +15,13 @@
*/
#include "apreq_util.h"
+#include "apreq_error.h"
#include "apr_time.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include <assert.h>
#define MIN(a,b) ( (a) < (b) ? (a) : (b) )
#define MAX(a,b) ( (a) > (b) ? (a) : (b) )
-
-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)
-{
- apreq_value_t *v = apr_palloc(p, vlen + nlen + 1 + sizeof *v);
-
- if (v == NULL)
- return NULL;
-
- memcpy(v->data, val, vlen);
- v->data[vlen] = 0;
- v->size = vlen;
-
- v->name = v->data + vlen + 1;
- memcpy(v->name, name, nlen);
- v->name[nlen] = 0;
-
- return v;
-}
APREQ_DECLARE(char *) apreq_expires(apr_pool_t *p, const char *time_str,
Modified: httpd/apreq/branches/multi-env-unstable/module/apache2/apreq_module_apache2.h
URL: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/module/apache2/apreq_module_apache2.h?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/module/apache2/apreq_module_apache2.h (original)
+++ httpd/apreq/branches/multi-env-unstable/module/apache2/apreq_module_apache2.h Fri Feb 18 14:07:36 2005
@@ -17,7 +17,7 @@
#ifndef APREQ_APACHE2_H
#define APREQ_APACHE2_H
-#include "apreq.h"
+#include "apreq_module.h"
#include <httpd.h>
#ifdef __cplusplus
Modified: httpd/apreq/branches/multi-env-unstable/module/apache2/filter.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/module/apache2/filter.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/module/apache2/filter.c (original)
+++ httpd/apreq/branches/multi-env-unstable/module/apache2/filter.c Fri Feb 18 14:07:36 2005
@@ -27,6 +27,8 @@
#include "apreq_module_apache2.h"
#include "apreq_private_apache2.h"
+#include "apreq_error.h"
+#include "apreq_util.h"
/**
* @defgroup mod_apreq Apache 2.X Filter Module
@@ -229,7 +231,7 @@
apreq_parser_function_t pf = apreq_parser(ct_header);
if (pf != NULL) {
- ctx->parser = apreq_make_parser(r->pool, ba, ct_header, pf,
+ ctx->parser = apreq_parser_make(r->pool, ba, ct_header, pf,
ctx->brigade_limit,
ctx->temp_dir,
ctx->hook_queue,
@@ -489,7 +491,7 @@
return APR_SUCCESS;
if (ctx->status == APR_INCOMPLETE) {
- ctx->status = apreq_run_parser(ctx->parser, ctx->body, ctx->bb);
+ ctx->status = apreq_parser_run(ctx->parser, ctx->body, ctx->bb);
apr_brigade_cleanup(ctx->bb);
}
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=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c (original)
+++ httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c Fri Feb 18 14:07:36 2005
@@ -27,7 +27,7 @@
#include "apreq_module_apache2.h"
#include "apreq_private_apache2.h"
-
+#include "apreq_error.h"
static apr_status_t apache2_jar(apreq_handle_t *env, const apr_table_t **t)
{
Modified: httpd/apreq/branches/multi-env-unstable/module/t/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/module/t/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/module/t/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c (original)
+++ httpd/apreq/branches/multi-env-unstable/module/t/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c Fri Feb 18 14:07:36 2005
@@ -71,9 +71,11 @@
ap_set_content_type(r, "text/plain");
if (strcmp(test, "bake") == 0) {
+ apreq_cookie_taint_off(cookie);
s = apreq_cookie_bake(cookie, req);
}
else if (strcmp(test, "bake2") == 0) {
+ apreq_cookie_taint_off(cookie);
s = apreq_cookie_bake2(cookie, req);
}
else {
Modified: httpd/apreq/branches/multi-env-unstable/module/test_cgi.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/module/test_cgi.c?view=diff&r1=154357&r2=154358
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/module/test_cgi.c (original)
+++ httpd/apreq/branches/multi-env-unstable/module/test_cgi.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_util.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include "apr_tables.h"
@@ -94,9 +95,11 @@
}
if (strcmp(test->v.data, "bake") == 0) {
+ apreq_cookie_taint_off(cookie);
apreq_cookie_bake(cookie, req);
}
else if (strcmp(test->v.data, "bake2") == 0) {
+ apreq_cookie_taint_off(cookie);
apreq_cookie_bake2(cookie, req);
}