Hello.
I can't get this HTTP Daemon work with a multipart form on Windows.
When I Dump the results I something like:
- -----------------------------200672192830548
Content-Disposition: form-data
- name
- "yourname"
this is the name i entered
-----------------------------200672192830548
Content-Disposition: form-data
- "Go"
Go
-----------------------------200672192830548--
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.