[Catalyst-commits] r6187 - in branches/HTTP-Body: . lib/HTTP
lib/HTTP/Body t/data/multipart
andyg at dev.catalyst.perl.org
andyg at dev.catalyst.perl.org
Fri Mar 23 17:39:37 GMT 2007
Author: andyg
Date: 2007-03-23 17:39:37 +0000 (Fri, 23 Mar 2007)
New Revision: 6187
Modified:
branches/HTTP-Body/Changes
branches/HTTP-Body/META.yml
branches/HTTP-Body/lib/HTTP/Body.pm
branches/HTTP-Body/lib/HTTP/Body/MultiPart.pm
branches/HTTP-Body/t/data/multipart/001-content.dat
branches/HTTP-Body/t/data/multipart/001-headers.yml
branches/HTTP-Body/t/data/multipart/001-results.yml
Log:
HTTP::Body 0.7, patch to support 0-length uploads
Modified: branches/HTTP-Body/Changes
===================================================================
--- branches/HTTP-Body/Changes 2007-03-23 17:30:04 UTC (rev 6186)
+++ branches/HTTP-Body/Changes 2007-03-23 17:39:37 UTC (rev 6187)
@@ -1,5 +1,9 @@
This file documents the revision history for Perl extension HTTP::Body.
+0.7 2007-03-23 10:00:00
+ - Fixed parsing an empty (zero-length) file using multipart.
+ http://rt.cpan.org/NoAuth/Bug.html?id=25392
+
0.6 2006-01-06 00:00:00
- Fixed buffer bug in OctetStream, reported by Daisuke Murase <typester at cpan.org>.
- Fixed YAML prereq, reported by Jess Robinson
Modified: branches/HTTP-Body/META.yml
===================================================================
--- branches/HTTP-Body/META.yml 2007-03-23 17:30:04 UTC (rev 6186)
+++ branches/HTTP-Body/META.yml 2007-03-23 17:39:37 UTC (rev 6187)
@@ -1,14 +1,14 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: HTTP-Body
-version: 0.4
+version: 0.7
version_from: lib/HTTP/Body.pm
installdirs: site
requires:
Carp: 0
File::Temp: 0.14
IO::File: 0
- YAML: 0
+ YAML: 0.39
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17
Modified: branches/HTTP-Body/lib/HTTP/Body/MultiPart.pm
===================================================================
--- branches/HTTP-Body/lib/HTTP/Body/MultiPart.pm 2007-03-23 17:30:04 UTC (rev 6186)
+++ branches/HTTP-Body/lib/HTTP/Body/MultiPart.pm 2007-03-23 17:39:37 UTC (rev 6187)
@@ -257,16 +257,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: branches/HTTP-Body/lib/HTTP/Body.pm
===================================================================
--- branches/HTTP-Body/lib/HTTP/Body.pm 2007-03-23 17:30:04 UTC (rev 6186)
+++ branches/HTTP-Body/lib/HTTP/Body.pm 2007-03-23 17:39:37 UTC (rev 6187)
@@ -4,7 +4,7 @@
use Carp qw[ ];
-our $VERSION = 0.6;
+our $VERSION = 0.7;
our $TYPES = {
'application/octet-stream' => 'HTTP::Body::OctetStream',
Modified: branches/HTTP-Body/t/data/multipart/001-content.dat
===================================================================
--- branches/HTTP-Body/t/data/multipart/001-content.dat 2007-03-23 17:30:04 UTC (rev 6186)
+++ branches/HTTP-Body/t/data/multipart/001-content.dat 2007-03-23 17:39:37 UTC (rev 6187)
@@ -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: branches/HTTP-Body/t/data/multipart/001-headers.yml
===================================================================
--- branches/HTTP-Body/t/data/multipart/001-headers.yml 2007-03-23 17:30:04 UTC (rev 6186)
+++ branches/HTTP-Body/t/data/multipart/001-headers.yml 2007-03-23 17:39:37 UTC (rev 6187)
@@ -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: branches/HTTP-Body/t/data/multipart/001-results.yml
===================================================================
--- branches/HTTP-Body/t/data/multipart/001-results.yml 2007-03-23 17:30:04 UTC (rev 6186)
+++ branches/HTTP-Body/t/data/multipart/001-results.yml 2007-03-23 17:39:37 UTC (rev 6187)
@@ -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