Hello. I have simple client POSTing multipart HTTP::Message to HTTP::Daemon-based server. Here is client code: ======================================================================= #!/usr/bin/perl -T use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new('POST', 'http://localhost:8089/');
$req->content_type('text/plain'); $req->content('First part'); my $second_part = HTTP::Message->new; $second_part->content_type('text/plain'); $second_part->content('Second part'); $req->add_part($second_part); #(1) my $resp = $ua->request($req); ======================================================================= This client sends incorrect message to server. Its Content-Type header is 'multipart/mixed', no 'boundary=...' part, so HTTP::Daemon does not recognize it as multipart. If I insert $req->as_string() in the string where #(1) is, client seems to work OK, but the server breaks. Here is server code: ======================================================================= #!/usr/bin/perl -T use HTTP::Daemon; my $d = HTTP::Daemon->new(LocalPort => 8089, ReuseAddr => 1) || die; my $c = $d->accept; my $req = $c->get_request(); $c->send_response(HTTP::Response->new(200)); $c->close; my @parts = $req->parts; print $parts[0]->decoded_content; print $parts[1]->decoded_content; $d->close(); ======================================================================= When client send correct multipart message (with boundary=... part in Content-Type), server waits forever. This issue was addressed in bug #28970 on CPAN RT (http://rt.cpan.org/Public/Bug/Display.html?id=28970). After applying patch mentioned there server seems to work as it should. So there are 2 flaws: 1. No 'boundary=...' part in Content-Type header of multipert/mixed message, which is created only after calling as_string() on HTTP::Request 2. HTTP::Daemon waits forever on receiving mutlipart/mixed message, which may be fixed with patch from CPAN RT. -- Constantin Stefanov