httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r122925 - /httpd/apreq/trunk/CHANGES /httpd/apreq/trunk/glue/perl/docs/Upload.pod /httpd/apreq/trunk/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h /httpd/apreq/trunk/src/apreq_params.c /httpd/apreq/trunk/src/apreq_version.h
Date Tue, 21 Dec 2004 01:50:23 GMT
Author: joes
Date: Mon Dec 20 17:50:22 2004
New Revision: 122925

URL: http://svn.apache.org/viewcvs?view=rev&rev=122925
Log:
apreq_upload and apreq_uploads did not search the full body table,
because their internal apr_table_do callbacks were returning the
wrong value.

$upload->slurp and $io->read did not autovivify the resultant string.
They both need to call SvSETMAGIC just prior to returning.

Modified:
   httpd/apreq/trunk/CHANGES
   httpd/apreq/trunk/glue/perl/docs/Upload.pod
   httpd/apreq/trunk/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h
   httpd/apreq/trunk/src/apreq_params.c
   httpd/apreq/trunk/src/apreq_version.h

Modified: httpd/apreq/trunk/CHANGES
Url: http://svn.apache.org/viewcvs/httpd/apreq/trunk/CHANGES?view=diff&rev=122925&p1=httpd/apreq/trunk/CHANGES&r1=122924&p2=httpd/apreq/trunk/CHANGES&r2=122925
==============================================================================
--- httpd/apreq/trunk/CHANGES	(original)
+++ httpd/apreq/trunk/CHANGES	Mon Dec 20 17:50:22 2004
@@ -4,6 +4,12 @@
 
 @section v2_05 Changes with libapreq2-2.05
 
+
+- C, Perl API [joes]
+  Several upload-related bugfixes:
+   1) apreq_upload and apreq_uploads did not search the full body table,
+   2) $upload->slurp and $io->read did not autovivify the resultant string.
+
 - C API [joes]
   Add "flags" attribute to apreq_value_t, planning for charset support.
   This is an ABI change, starting with libapreq2.so.2.0.24.

Modified: httpd/apreq/trunk/glue/perl/docs/Upload.pod
Url: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/docs/Upload.pod?view=diff&rev=122925&p1=httpd/apreq/trunk/glue/perl/docs/Upload.pod&r1=122924&p2=httpd/apreq/trunk/glue/perl/docs/Upload.pod&r2=122925
==============================================================================
--- httpd/apreq/trunk/glue/perl/docs/Upload.pod	(original)
+++ httpd/apreq/trunk/glue/perl/docs/Upload.pod	Mon Dec 20 17:50:22 2004
@@ -11,6 +11,7 @@
     $u = Apache::Upload->new($r, name => "foo", file => __FILE__);
     $req->body_status(0);
     $req->parse;
+    $req->body->add(foo => "bar"); # dummy param with same name as upload
     $req->body->add($u);
     open(my $fh, __FILE__) or die $!;
     binmode $fh;
@@ -26,6 +27,7 @@
 
 =head1 SYNOPSIS
 
+
 =for example begin
 
     use Apache::Upload;
@@ -41,13 +43,15 @@
     read $upload->fh, $fh_data, $size;
     ok $slurp_data eq $fh_data;
 
-    $io = $upload->io;
+    my $io = $upload->io;
     print while <$io>;
 
 =for example end
 
 =for example_testing
     ok $upload->bb->length == $size;
+    $uploads = $req->upload();
+    is (scalar keys %{$uploads}, 1, "found upload");
     is $_STDOUT_, $data;
     is $fh_data, $data;
     is $slurp_data, $data;
@@ -55,6 +59,7 @@
 
 
 
+
 =head1 DESCRIPTION
 
 Apache::Upload is a new module based on the original package included
@@ -82,8 +87,8 @@
 
 The name of the HTML form element which generated the upload.
 
-=for example_testing
-    is $upload->name, "foo";
+=for testing
+    is $u->name, "foo";
 
 
 
@@ -96,8 +101,8 @@
 some agents will submit the file's full pathname, while others 
 may submit just the basename.
 
-=for example_testing
-    is $upload->filename, __FILE__;
+=for testing
+    is $u->filename, __FILE__;
 
 
 
@@ -136,6 +141,9 @@
 
 =for example_testing
     is $_STDOUT_, $data;
+    $io = $upload->io;
+    $io->read($h{io}, $upload->size);
+    is $h{io}, $data, "autovivifying read";
 
 See L<READ|read> and L<READLINE|readline> below for additional notes 
 on their usage.
@@ -158,8 +166,8 @@
 
 Returns the size of the upload in bytes.
 
-=for example_testing
-    is $upload->size, -s __FILE__;
+=for testing
+    is $u->size, -s __FILE__;
 
 
 
@@ -255,6 +263,8 @@
 
 =for example_testing
     is $size, length $contents;
+    $upload->slurp($h{slurp});
+    is $h{slurp}, $contents, "autovivifying slurp";
     $contents =~ s{\r}{}g;
     is $contents, $data;
 

Modified: httpd/apreq/trunk/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h
Url: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h?view=diff&rev=122925&p1=httpd/apreq/trunk/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h&r1=122924&p2=httpd/apreq/trunk/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h&r2=122925
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h	(original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/Apache/Upload/Apache__Upload.h	Mon Dec 20 17:50:22
2004
@@ -291,6 +291,7 @@
     }
     if (SvTAINTED(obj))
         SvTAINTED_on(ST(1));
+    SvSETMAGIC(ST(1));
     XSRETURN_IV(len_size);
 }
 
@@ -496,6 +497,7 @@
 
     *buf = 0;
     SvPOK_only(sv);
+    SvSETMAGIC(sv);
     XSRETURN_IV(want);
 }
 

Modified: httpd/apreq/trunk/src/apreq_params.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/trunk/src/apreq_params.c?view=diff&rev=122925&p1=httpd/apreq/trunk/src/apreq_params.c&r1=122924&p2=httpd/apreq/trunk/src/apreq_params.c&r2=122925
==============================================================================
--- httpd/apreq/trunk/src/apreq_params.c	(original)
+++ httpd/apreq/trunk/src/apreq_params.c	Mon Dec 20 17:50:22 2004
@@ -21,9 +21,8 @@
 
 #define MAX_LEN         (1024 * 1024)
 #define MAX_BRIGADE_LEN (1024 * 256)
-#define MAX_FIELDS      (200)
 #define MAX_READ_AHEAD  (1024 * 64)
-    
+
 APREQ_DECLARE(apreq_param_t *) apreq_make_param(apr_pool_t *p, 
                                                 const char *name, 
                                                 const apr_size_t nlen, 
@@ -147,7 +146,7 @@
     apr_array_header_t *arr = data;
     *(apreq_param_t **)apr_array_push(arr) = 
         apreq_value_to_param(apreq_strtoval(val));
-    return 1;
+    return 1;   /* keep going */
 }
 
 
@@ -323,7 +322,7 @@
     apreq_param_t *p = apreq_value_to_param(apreq_strtoval(val));
     if (p->bb)
         apr_table_addn(t, key, val);
-    return 0;
+    return 1;   /* keep going */
 }
 
 
@@ -354,10 +353,10 @@
     apreq_param_t **q = data;
     if (p->bb) {
         *q = p;
-        return 1; /* upload found, stop */
+        return 0; /* upload found, stop */
     }
     else
-        return 0; /* keep searching */
+        return 1; /* keep searching */
 }
 
 

Modified: httpd/apreq/trunk/src/apreq_version.h
Url: http://svn.apache.org/viewcvs/httpd/apreq/trunk/src/apreq_version.h?view=diff&rev=122925&p1=httpd/apreq/trunk/src/apreq_version.h&r1=122924&p2=httpd/apreq/trunk/src/apreq_version.h&r2=122925
==============================================================================
--- httpd/apreq/trunk/src/apreq_version.h	(original)
+++ httpd/apreq/trunk/src/apreq_version.h	Mon Dec 20 17:50:22 2004
@@ -61,7 +61,7 @@
 #define APREQ_MINOR_VERSION       0
 
 /** patch level */
-#define APREQ_PATCH_VERSION      24
+#define APREQ_PATCH_VERSION      25
 
 /** 
  *  This symbol is defined for internal, "development" copies of libapreq.

Mime
View raw message