M
Miroslav Suchy
Hello,
I have following code:
my $daemon = HTTP:
aemon->new(
ReuseAddr => 1,
LocalAddr => 'mydomain.com',
LocalPort => 8888,
) or die "Cannot start daemon: $!\n";
while (my $conn = $daemon->accept()) {
while (my $req = $conn->get_request()) {
if ($req->method() eq 'GET') { # I do not use GET
$q = CGI->new($url->query());
} elsif ($req->method() eq 'POST') { # I only use POST method
$q = CGI->new($req->content);
open FF, ">/tmp/debug"; #output to FF just for debug
print FF $req->content;
close FF;
}
print STDERR "params: ", join(',', $q->param), "\n";
}
}
And it does not work as I expect. This is content of file "/tmp/debug":
-----------------------------18004688081790386843384315354
Content-Disposition: form-data; name="id"
6
-----------------------------18004688081790386843384315354
Content-Disposition: form-data; name="pw"
aa
-----------------------------18004688081790386843384315354--
I expect following output from script:
params: id,pw
but I get this output:
params: -----------------------------18004688081790386843384315354
Content-Disposition: form-data, name
What I'm doing wrong? Thank you.
Miroslav Suchy
I have following code:
my $daemon = HTTP:
ReuseAddr => 1,
LocalAddr => 'mydomain.com',
LocalPort => 8888,
) or die "Cannot start daemon: $!\n";
while (my $conn = $daemon->accept()) {
while (my $req = $conn->get_request()) {
if ($req->method() eq 'GET') { # I do not use GET
$q = CGI->new($url->query());
} elsif ($req->method() eq 'POST') { # I only use POST method
$q = CGI->new($req->content);
open FF, ">/tmp/debug"; #output to FF just for debug
print FF $req->content;
close FF;
}
print STDERR "params: ", join(',', $q->param), "\n";
}
}
And it does not work as I expect. This is content of file "/tmp/debug":
-----------------------------18004688081790386843384315354
Content-Disposition: form-data; name="id"
6
-----------------------------18004688081790386843384315354
Content-Disposition: form-data; name="pw"
aa
-----------------------------18004688081790386843384315354--
I expect following output from script:
params: id,pw
but I get this output:
params: -----------------------------18004688081790386843384315354
Content-Disposition: form-data, name
What I'm doing wrong? Thank you.
Miroslav Suchy