Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: keeping connection alive while spending time building a zip file

by strredwolf (Chaplain)
on Aug 11, 2011 at 02:02 UTC ( #919782=note: print w/ replies, xml ) Need Help??


in reply to keeping connection alive while spending time building a zip file

Short of timed-redirects, you need to off-load the ZIPping of the files to a separate process that you can fire off (say, a Unix socket based server of your own design in Perl). Then, use Javascript on the client and a small bit of AJAX to send up status info. When it's done, have the Javascript redirect to the file.
Information doesn't want to be free. It wants to be feline.
  • Comment on Re: keeping connection alive while spending time building a zip file

Replies are listed 'Best First'.
Re^2: keeping connection alive while spending time building a zip file
by afoken (Monsignor) on Aug 11, 2011 at 11:28 UTC

    What if Javscript is not available (links, lynx, wget, curl, LWP::UserAgent) or blocked (NoScript, ...)?

    Some people, when confronted with a problem, think "I know, I'll use Javascript." Now they have two problems.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      If you use fork, and build the zip file with the child process, then the parent process can redirect to a "status" page. The status page will either display "working..." or "not done yet" while the zip is being built, or else display a clickable link to the zip once it's done. The ajax/javascript version of the page will automatically refresh the status every few seconds. If javascript is not available, you could try using a meta tag refresh, or else instruct users to click "reload" periodically (or put a message like "check back later" inside a noscript tag).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://919782]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2016-07-27 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (243 votes). Check out past polls.