joes 2004/04/12 17:41:55
Modified: . STATUS CHANGES
glue/perl/xsbuilder apreq_xs_postperl.h
glue/perl/xsbuilder/Apache/Request Apache__Request.h
Log:
Fix a few bugs related to $req->upload:
$req->upload() in list context fails to filter out non-uploads.
Also $req->upload("nonexistent-key-name") reportedly segfaults.
Revision Changes Path
1.41 +1 -4 httpd-apreq-2/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/httpd-apreq-2/STATUS,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- STATUS 8 Apr 2004 15:16:38 -0000 1.40
+++ STATUS 13 Apr 2004 00:41:55 -0000 1.41
@@ -67,9 +67,6 @@
BUGS:
- - $req->upload() in list context fails to filter out non-uploads.
- Also $req->upload("nonexistent-key-name") reportedly segfaults.
-
- Strange bug when ssl is enabled & lots of fields are present: see
http://marc.theaimsgroup.com/?t=107766265600001&r=1&w=2
1.30 +4 -0 httpd-apreq-2/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-apreq-2/CHANGES,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- CHANGES 25 Mar 2004 00:44:36 -0000 1.29
+++ CHANGES 13 Apr 2004 00:41:55 -0000 1.30
@@ -3,6 +3,10 @@
@section v2_03_dev Changes with libapreq2-2.03-dev
+- Perl API [joes]
+ $req->upload() in list context failed to filter out non-uploads.
+ Also $req->upload("nonexistent-key-name") segfaults.
+
- Perl test suite
t/TEST.PL must run parent class' pre_configure to get the
configuration right
1.24 +1 -1 httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h
Index: apreq_xs_postperl.h
===================================================================
RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- apreq_xs_postperl.h 28 Feb 2004 07:48:14 -0000 1.23
+++ apreq_xs_postperl.h 13 Apr 2004 00:41:55 -0000 1.24
@@ -338,7 +338,7 @@
} \
\
RETVAL = apreq_xs_##attr##_##type(ST(0), key); \
- if (!(COND) || !RETVAL) \
+ if (!RETVAL || !(COND)) \
XSRETURN_UNDEF; \
ST(0) = sv_2mortal(apreq_xs_##type##2sv(RETVAL,subclass)); \
XSRETURN(1); \
1.22 +23 -1
httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h
Index: Apache__Request.h
===================================================================
RCS file:
/home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Apache__Request.h 24 Mar 2004 21:03:57 -0000 1.21
+++ Apache__Request.h 13 Apr 2004 00:41:55 -0000 1.22
@@ -38,13 +38,16 @@
#define apreq_xs_args_push(sv,d,k) apreq_xs_push(args,sv,d,k)
#define apreq_xs_body_push(sv,d,k) apreq_xs_push(body,sv,d,k)
#define apreq_xs_table_push(sv,d,k) apreq_xs_push(table,sv,d,k)
+#define apreq_xs_upload_do (items==1 ? apreq_xs_upload_table_keys \
+ : apreq_xs_upload_table_values)
+
#define apreq_xs_upload_push(sv,d,key) do { \
apreq_request_t *req = apreq_xs_sv2(request,sv); \
apr_status_t s; \
do s = apreq_env_read(req->env, APR_BLOCK_READ, READ_BLOCK_SIZE); \
while (s == APR_INCOMPLETE); \
if (req->body) \
- apr_table_do(apreq_xs_do(upload), d, req->body, key, NULL); \
+ apr_table_do(apreq_xs_upload_do, d, req->body, key, NULL); \
} while (0)
#define apreq_xs_upload_table_push(sv,d,k) apreq_xs_push(upload_table,sv,d,k)
@@ -89,6 +92,25 @@
#define apreq_xs_param2sv(param,class) apreq_xs_param2rv(param,class)
#define apreq_xs_sv2param(sv) apreq_xs_rv2param(sv)
+static int apreq_xs_upload_table_keys(void *data, const char *key,
+ const char *val)
+{
+ struct apreq_xs_do_arg *d = (struct apreq_xs_do_arg *)data;
+ apreq_param_t *param = apreq_value_to_param(apreq_strtoval(val));
+ dTHXa(d->perl);
+ dSP;
+ if (param->bb == NULL) /* not an upload, so skip it */
+ return 1;
+
+ if (key)
+ XPUSHs(sv_2mortal(newSVpv(key,0)));
+ else
+ XPUSHs(&PL_sv_undef);
+
+ PUTBACK;
+ return 1;
+
+}
#define UPLOAD_TABLE "Apache::Upload::Table"
#define UPLOAD_PKG "Apache::Upload"