[Catalyst-commits] r6184 - in trunk/HTTP-Body: lib/HTTP/Body/Parser
t/data/multipart
ash at dev.catalyst.perl.org
ash at dev.catalyst.perl.org
Fri Mar 23 14:23:11 GMT 2007
Author: ash
Date: 2007-03-23 14:23:10 +0000 (Fri, 23 Mar 2007)
New Revision: 6184
Modified:
trunk/HTTP-Body/lib/HTTP/Body/Parser/MultiPart.pm
trunk/HTTP-Body/t/data/multipart/001-content.dat
trunk/HTTP-Body/t/data/multipart/001-headers.yml
trunk/HTTP-Body/t/data/multipart/001-results.yml
Log:
Empty file support (rt.cpan ticket #25392)
Modified: trunk/HTTP-Body/lib/HTTP/Body/Parser/MultiPart.pm
===================================================================
--- trunk/HTTP-Body/lib/HTTP/Body/Parser/MultiPart.pm 2007-03-23 00:33:24 UTC (rev 6183)
+++ trunk/HTTP-Body/lib/HTTP/Body/Parser/MultiPart.pm 2007-03-23 14:23:10 UTC (rev 6184)
@@ -189,16 +189,17 @@
sub handler {
my ( $self, $part ) = @_;
+ my $disposition = $part->{headers}->{'Content-Disposition'};
+ my ($name) = $disposition =~ / name="?([^\";]+)"?/;
+ my ($filename) = $disposition =~ / filename="?([^\"]+)"?/;
+
# skip parts without content
- if ( $part->{done} && $part->{size} == 0 ) {
+ if ( $part->{done} && $part->{size} == 0 && !$filename) {
return 0;
}
unless ( exists $part->{name} ) {
- my $disposition = $part->{headers}->{'Content-Disposition'};
- my ($name) = $disposition =~ / name="?([^\";]+)"?/;
- my ($filename) = $disposition =~ / filename="?([^\"]+)"?/;
$part->{name} = $name;
$part->{filename} = $filename;
Modified: trunk/HTTP-Body/t/data/multipart/001-content.dat
===================================================================
--- trunk/HTTP-Body/t/data/multipart/001-content.dat 2007-03-23 00:33:24 UTC (rev 6183)
+++ trunk/HTTP-Body/t/data/multipart/001-content.dat 2007-03-23 14:23:10 UTC (rev 6184)
@@ -60,4 +60,9 @@
print "Hello World :)\n";
+------------0xKhTmLbOuNdArY
+Content-Disposition: form-data; name="upload3"; filename="blank.pl"
+Content-Type: application/octet-stream
+
+
------------0xKhTmLbOuNdArY--
Modified: trunk/HTTP-Body/t/data/multipart/001-headers.yml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/001-headers.yml 2007-03-23 00:33:24 UTC (rev 6183)
+++ trunk/HTTP-Body/t/data/multipart/001-headers.yml 2007-03-23 14:23:10 UTC (rev 6184)
@@ -1,4 +1,4 @@
---
-Content-Length: 1559
+Content-Length: 1701
Content-Type: multipart/form-data; boundary=----------0xKhTmLbOuNdArY
User-Agent: 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312'
Modified: trunk/HTTP-Body/t/data/multipart/001-results.yml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/001-results.yml 2007-03-23 00:33:24 UTC (rev 6183)
+++ trunk/HTTP-Body/t/data/multipart/001-results.yml 2007-03-23 14:23:10 UTC (rev 6184)
@@ -27,3 +27,10 @@
Content-Type: application/octet-stream
name: upload2
size: 71
+ upload3:
+ filename: blank.pl
+ headers:
+ Content-Disposition: form-data; name="upload3"; filename="blank.pl"
+ Content-Type: application/octet-stream
+ name: upload3
+ size: 0
More information about the Catalyst-commits
mailing list