Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello. I can't get this HTTP Daemon work with a multipart form on Windows. When I Dump the results I something like: Here it is:
use strict; use CGI; use HTTP::Daemon; use HTTP::Status; my ($HOST) = $ENV{SERVER_NAME} =~ /(.*)/s; # untaint my $PORT = 1234; my $d = new HTTP::Daemon(LocalAddr=>$HOST,LocalPort=>$PORT,Reuse=>1); print "Please contact me at: <URL:" . $d->url . ">\n"; while (my $c = $d->accept) { while (my $r = $c->get_request) { if ($r) { my $query = new CGI $r->content; $c->send_basic_header; print $c $query->header; print $c $query->start_html; print $c $query->start_form(-enctype=>$query->MULTIPART); print $c $query->textfield("yourname"); print $c $query->submit("Go"); print $c $query->end_form; if ($query->param('yourname')) { print $c "hello "; print $c $query->param('yourname'); print $c " ... !"; } print $c $query->Dump; print $c $query->end_html; close $c; } else { $c->send_error(RC_FORBIDDEN) } } $c->close; undef($c); }
Is this the famous Windows CRLF problem or mine? Thanks in advance. Thomas

Replies are listed 'Best First'.
Re: HTTP Daemon with multipart form on Windows problem
by Aristotle (Chancellor) on May 30, 2002 at 13:55 UTC

    CGI does not support parsing multipart data that way with new().

    Final update: (I erased a whole lot of tomfoolery with the CGI module. Forget it.) What you need is some MIME:: module, not CGI.pm, in fact.

    You will probably need to do something like my($content_type) = grep /^Content-type: /, split /\r?\n/, $r->headers; in there too because that's where the boundary code (in your case, 200672192830548) lives.

    ____________
    Makeshifts last the longest.