Commit | Line | Data |
6a0eb7a7 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use lib './lib'; |
6 | |
7 | use Data::Dumper; |
32b29b79 |
8 | use HTTP::Body; |
6a0eb7a7 |
9 | use IO::File; |
10 | use YAML qw[LoadFile]; |
11 | |
12 | my $test = shift(@ARGV) || 1; |
13 | |
32b29b79 |
14 | my $headers = LoadFile( sprintf( "t/data/multipart/%.3d-headers.yml", $test ) ); |
15 | my $content = IO::File->new( sprintf( "t/data/multipart/%.3d-content.dat", $test ), O_RDONLY ); |
58050177 |
16 | my $body = HTTP::Body->new( $headers->{'Content-Type'}, $headers->{'Content-Length'} ); |
6a0eb7a7 |
17 | |
18 | binmode $content; |
19 | |
20 | while ( $content->read( my $buffer, 1024 ) ) { |
58050177 |
21 | $body->add($buffer); |
6a0eb7a7 |
22 | } |
23 | |
58050177 |
24 | warn Dumper( $body->param ); |
25 | warn Dumper( $body->upload ); |
26 | warn Dumper( $body->body ); |
6a0eb7a7 |
27 | |
58050177 |
28 | warn "length : " . $body->length; |
29 | warn "content length : " . $body->content_length; |
30 | warn "state : " . $body->{state}; |
31 | warn "buffer : " . $body->buffer; |