Here is the answer I gave about a day ago, but like a foolish man I
posted it to the wrong list (beginners instead of beginners-cgi).
Foolish Outlook mistake on my part. Sorry about that. But anyway, here
ya go:
I was involved in the writing of www.e-mol.com and we ran into this same
problem, only with a different situation. E-mol.com allows you to check
your POP3 email from anywhere in the world. Sounded easy enough. But,
what if somebody has 75,000 messages? Well, the browser would time out
waiting for our scripts to get the mail. So, Brian (a different Brian,
not me) wrote a small javascript on the page that updated a process bar.
Then what he did was print a call to the JavaScript to the browser every
few seconds. This gave the client something to look at, and it also let
them know how much progress was being made as well as how much was left.
Worked fantastic for us.
Now, I'm not saying this is or isn't the right way to do it, but it's
working great for us. If you log onto e-mol.com you'll see the progress
bar. If you do a view source after it moves across a bit, then scroll
down, you'll see the calls to the JS. Hope this helps you out.
Brian Johnson
Partner/Systems Administrator/Programmer
Source1Hosting.tv, LLC (www.source1hosting.tv)
Source1Results.com, LLC (www.source1results.com)
I may be insane, but remember - The only
difference between an insane man and a
genius is his jacket.
> -----Original Message-----
> From: daedalus [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 18, 2001 11:49 AM
> To: [EMAIL PROTECTED]
> Subject: I don't know what to title this question...
>
>
> Hmm... I tried posting this at [EMAIL PROTECTED] but
> haven't gotten
> much back so I'll try here...
>
> Hi all,
>
> I hope this isn't a goofy question ;-) I have a simple CGI front end
> for processing Snort logs with Calamaris. It is currently set
> up like this:
>
> sub do_report
> { local ($command) = @_;
> $| = 1;
> print "Content-type: text/html \n\n";
> system ("$command 2> /dev/null");
> } # end sub do_report
>
> $command is something like:
> $command = "cat /my/log | /path/to/calamaris -options -to
> -output -html -etc"
>
> This works fine when processing smallish logs. However, as my
> logs have
> grown, I frequently get browser time outs. What I was
> thinking is to start
> the log processing then send some sort or server push animation until
> Calamaris is done then push the resulting report. Is this
> the correct way
> to go about this? If so, how? If not, what is the "right" way?
>
> Here is my first attempt to solve this:
>
> sub do_report
> { local ($command) = @_;
> $| = 1;
> print "Content-type:
> multipart/x-mixed-replace;boundary=End\n\n";
> open REPORT, "$command 2> /dev/null |" or die
> my $message = "Working";
> until (<REPORT>)
> { $message .= ".";
> print "Content-type: text/plain\n\n$message\n--End\n"
> sleep(1);
> }# end until
> print "Content-type: text/html\n\n";
> while (<REPORT>)
> { print;
> }# end while
> print "\n--End--\n"
>
> But this doesn't work )-;
>
> Maybe someone will get a better idea of what I'm trying to do
> from it though. Thanks again for any help.
> Thanks to all for any input,
> -Bill
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]