Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Where's my CGI hook going?

11 views
Skip to first unread message

Gerrit Schimpf

unread,
May 18, 2006, 10:34:33 AM5/18/06
to
Hi!

After looking at
http://search.cpan.org/~lgoddard/CGI-ProgressBar-0.04/ProgressBar.pm
I tried to show the upload-process from a multipart-request via
callback: my $cgi = CGI->new(\&bar_hook, $data);

For me it seems, that the processes does not end, as well a Testing of
the ProgressBar.pm shows endless processing. Are there know problems
with the callback-feature or is my code stupid?

[...]
my $data;
my $hook_called;
my $cgi = CGI->new(\&bar_hook, $data);

[...]
sub bar_hook
{
my ($filename, $buffer, $bytes, $data) = @_;
if (not $hook_called)
{
print header,
start_html( -title=>'Simple Upload-hook Example'),
h1('Uploading'),
p( "Have to read <var>$filename</var> Size
<var>$ENV{CONTENT_LENGTH}</var>"),
hr;
$hook_called = 1;
}
else
{
print "Content Length [$ENV{CONTENT_LENGTH}] <br>bytes_read
[$bytes] sum [$hook_called]...";
}
$hook_called += $bytes;
}

Response shows:
Uploading

Have to read ascotel_01.jpg Size 95127
Content Length [95127]
bytes_read [4155] sum [4039]...Content Length [95127]
bytes_read [4155] sum [8194]...Content Length [95127]
bytes_read [4155] sum [12349]...Content Length [95127]
bytes_read [4155] sum [16504]...Content Length [95127]
bytes_read [4155] sum [20659]...Content Length [95127]
bytes_read [4155] sum [24814]...Content Length [95127]
bytes_read [4155] sum [28969]...Content Length [95127]
bytes_read [4155] sum [33124]...Content Length [95127]
bytes_read [4155] sum [37279]...Content Length [95127]
bytes_read [4155] sum [41434]...Content Length [95127]
[... lot of more lines]

After some seconds logfile gets:
[Wed May 10 18:27:53 2006] [error] [client 192.168.1.3] CGI.pm: Server
closed socket during multipart read (client aborted?)., referer:
http://192.168.1.3:12080/cgi-bin/hookme.cgi


Thanks for hints in advance,

--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html

0 new messages