Author: joes
Date: Mon Feb 21 22:27:27 2005
New Revision: 154800
URL: http://svn.apache.org/viewcvs?view=rev&rev=154800
Log:
Get the glue/perl/t/apreq/big_input tests passing again on *nix.
Also reorder apreq_params arguments to match OO pattern.
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Request.pm
httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t
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/apreq_xs_postperl.h
httpd/apreq/branches/multi-env-unstable/include/apreq_module.h
httpd/apreq/branches/multi-env-unstable/library/module.c
httpd/apreq/branches/multi-env-unstable/module/apache2/filter.c
httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c
httpd/apreq/branches/multi-env-unstable/module/test_cgi.c
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Request.pm
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Request.pm?view=diff&r1=154799&r2=154800
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Request.pm
(original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Request.pm Mon
Feb 21 22:27:27 2005
@@ -3,6 +3,19 @@
use Apache::RequestRec;
push our @ISA, qw/Apache::RequestRec APR::Request::Apache2/;
+sub param {
+ return &APR::Request::args, &APR::Request::body
+ if wantarray;
+
+ my ($req, $key) = @_;
+
+ return APR::Request::params($req, $req->pool)
+ if @_ == 1;
+
+ return APR::Request::param($req, $key);
+}
+
+
package Apache::Upload;
use APR::Request::Param;
push our @ISA, qw/APR::Request::Param/;
Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t?view=diff&r1=154799&r2=154800
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t
(original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/t/apreq/big_input.t Mon
Feb 21 22:27:27 2005
@@ -18,7 +18,7 @@
my @big_key_num = (5, 15, 25);
my @big_keys = ('a'..'z');
-plan tests => @key_len * @key_num + @big_key_len * @big_key_num,
under_construction;
+plan tests => @key_len * @key_num + @big_key_len * @big_key_num, have_lwp;
# GET
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=154799&r2=154800
==============================================================================
---
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
Mon Feb 21 22:27:27 2005
@@ -38,7 +38,7 @@
IV iv;
if (items == 0 || items > 2 || !SvROK(ST(0))
- || !sv_derived_from(ST(0), "APR::Request"))
+ || !sv_derived_from(ST(0), HANDLE_CLASS))
Perl_croak(aTHX_ "Usage: APR::Request::args($req [,$name])");
sv = ST(0);
@@ -80,7 +80,7 @@
XSRETURN_EMPTY;
d.pkg = PARAM_CLASS;
- d.parent = SvRV(obj);
+ d.parent = obj;
switch (GIMME_V) {
@@ -114,12 +114,12 @@
IV iv;
if (items == 0 || items > 2 || !SvROK(ST(0))
- || !sv_derived_from(ST(0), "APR::Request"))
+ || !sv_derived_from(ST(0),HANDLE_CLASS))
Perl_croak(aTHX_ "Usage: APR::Request::body($req [,$name])");
sv = ST(0);
obj = apreq_xs_sv2object(aTHX_ sv, HANDLE_CLASS, 'r');
- iv = SvIVX(SvRV(obj));
+ iv = SvIVX(obj);
req = INT2PTR(apreq_handle_t *, iv);
@@ -156,7 +156,7 @@
XSRETURN_EMPTY;
d.pkg = PARAM_CLASS;
- d.parent = SvRV(obj);
+ d.parent = obj;
switch (GIMME_V) {
@@ -403,3 +403,52 @@
OUTPUT:
RETVAL
+
+MODULE = APR::Request::Param PACKAGE = APR::Request
+
+SV*
+param(handle, key)
+ SV *handle
+ char *key
+ PREINIT:
+ SV *obj;
+ IV iv;
+ apreq_handle_t *req;
+ apreq_param_t *param;
+
+ CODE:
+ obj = apreq_xs_sv2object(aTHX_ handle, HANDLE_CLASS, 'r');
+ iv = SvIVX(obj);
+ req = INT2PTR(apreq_handle_t *, iv);
+ param = apreq_param(req, key);
+
+ if (param == NULL)
+ RETVAL = &PL_sv_undef;
+ else
+ RETVAL = apreq_xs_param2sv(aTHX_ param, PARAM_CLASS, obj);
+
+
+ OUTPUT:
+ RETVAL
+
+SV *
+params(handle, pool)
+ SV *handle
+ APR::Pool pool
+ PREINIT:
+ SV *obj;
+ IV iv;
+ apreq_handle_t *req;
+ apr_table_t *t;
+
+ CODE:
+ obj = apreq_xs_sv2object(aTHX_ handle, HANDLE_CLASS, 'r');
+ iv = SvIVX(obj);
+ req = INT2PTR(apreq_handle_t *, iv);
+ t = apreq_params(req, pool);
+ RETVAL = apreq_xs_table2sv(aTHX_ t, TABLE_CLASS, obj,
+ PARAM_CLASS, sizeof(PARAM_CLASS)-1);
+
+ 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=154799&r2=154800
==============================================================================
---
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
Mon Feb 21 22:27:27 2005
@@ -28,6 +28,8 @@
PUTBACK;
}
+
+
MODULE = APR::Request PACKAGE = APR::Request
SV*
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h?view=diff&r1=154799&r2=154800
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h
Mon Feb 21 22:27:27 2005
@@ -365,7 +365,7 @@
#define APREQ_XS_THROW_ERROR(attr, status, func, errpkg) do { \
if (!sv_derived_from(sv, errpkg)) { \
HV *hv = newHV(); \
- SV *rv = newRV_inc(SvRV(obj)); \
+ SV *rv = newRV_inc(obj); \
sv_setsv(*hv_fetch(hv, "_" #attr, 2, 1), sv_2mortal(rv)); \
apreq_xs_croak(aTHX_ hv, status, func, errpkg); \
} \
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=154799&r2=154800
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/include/apreq_module.h (original)
+++ httpd/apreq/branches/multi-env-unstable/include/apreq_module.h Mon Feb 21
22:27:27 2005
@@ -77,7 +77,8 @@
case APR_INCOMPLETE:
case APR_EINIT:
case APREQ_ERROR_NODATA:
-
+ case APREQ_ERROR_NOPARSER:
+ case APREQ_ERROR_NOHEADER:
return 0;
default:
return 1;
@@ -353,8 +354,7 @@
APREQ_DECLARE(unsigned)apreq_ua_cookie_version(apreq_handle_t *req);
-APREQ_DECLARE(apreq_param_t *)apreq_param(apreq_handle_t *env,
- const char *name);
+APREQ_DECLARE(apreq_param_t *)apreq_param(apreq_handle_t *req, const char
*key);
#define apreq_cookie(req, name) apreq_jar_get(req, name)
@@ -365,12 +365,10 @@
* @req
* @remark Also parses the request if necessary.
*/
-APREQ_DECLARE(apr_table_t *) apreq_params(apr_pool_t *p,
- apreq_handle_t *req);
+APREQ_DECLARE(apr_table_t *) apreq_params(apreq_handle_t *req, apr_pool_t *p);
-APREQ_DECLARE(apr_table_t *)apreq_cookies(apr_pool_t *p,
- apreq_handle_t *req);
+APREQ_DECLARE(apr_table_t *)apreq_cookies(apreq_handle_t *req, apr_pool_t *p);
/**
* Force a complete parse.
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=154799&r2=154800
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/module.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/module.c Mon Feb 21
22:27:27 2005
@@ -88,30 +88,28 @@
}
-APREQ_DECLARE(apreq_param_t *)apreq_param(apreq_handle_t *env,
- const char *name)
+APREQ_DECLARE(apreq_param_t *)apreq_param(apreq_handle_t *req, const char *key)
{
- apreq_param_t *param = apreq_args_get(env, name);
+ apreq_param_t *param = apreq_args_get(req, key);
if (param == NULL)
- return apreq_body_get(env, name);
+ return apreq_body_get(req, key);
else
return param;
}
-APREQ_DECLARE(apr_table_t *)apreq_params(apr_pool_t *pool,
- apreq_handle_t *env)
+APREQ_DECLARE(apr_table_t *)apreq_params(apreq_handle_t *req, apr_pool_t *p)
{
const apr_table_t *args, *body;
- if (apreq_args(env, &args) == APR_SUCCESS)
- if (apreq_body(env, &body) == APR_SUCCESS)
- return apr_table_overlay(pool, args, body);
+ if (apreq_args(req, &args) == APR_SUCCESS)
+ if (apreq_body(req, &body) == APR_SUCCESS)
+ return apr_table_overlay(p, args, body);
else
- return apr_table_copy(pool, args);
+ return apr_table_copy(p, args);
else
- if (apreq_body(env, &body) == APR_SUCCESS)
- return apr_table_copy(pool, body);
+ if (apreq_body(req, &body) == APR_SUCCESS)
+ return apr_table_copy(p, body);
else
return NULL;
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=154799&r2=154800
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/module/apache2/filter.c (original)
+++ httpd/apreq/branches/multi-env-unstable/module/apache2/filter.c Mon Feb 21
22:27:27 2005
@@ -243,7 +243,7 @@
}
}
else {
- ctx->status = APREQ_ERROR_NOPARSER;
+ ctx->status = APREQ_ERROR_NOHEADER;
return;
}
}
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=154799&r2=154800
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c (original)
+++ httpd/apreq/branches/multi-env-unstable/module/apache2/handle.c Mon Feb 21
22:27:27 2005
@@ -128,9 +128,9 @@
return APR_SUCCESS;
}
-static apr_status_t apache2_body(apreq_handle_t *env, const apr_table_t **t)
+static apr_status_t apache2_body(apreq_handle_t *req, const apr_table_t **t)
{
- ap_filter_t *f = get_apreq_filter(env);
+ ap_filter_t *f = get_apreq_filter(req);
struct filter_ctx *ctx;
if (f->ctx == NULL)
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=154799&r2=154800
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/module/test_cgi.c (original)
+++ httpd/apreq/branches/multi-env-unstable/module/test_cgi.c Mon Feb 21
22:27:27 2005
@@ -116,7 +116,7 @@
}
else {
- const apr_table_t *params = apreq_params(pool, req);
+ const apr_table_t *params = apreq_params(req, pool);
int count = 0;
apr_file_printf(out, "%s", "Content-Type: text/plain\n\n");