If you don't have control of the web server you're going to have to get creative. Instead of returning the zip file from the page that processes the request, you could:

* ok - Fork a process to build the zip and place it in a location specific to the user or their session then return a page with a link to that location and a warning that the link may not work for a few minutes

* better - If you're comfortable with javascript (or meta-refresh at a pinch), you could fork the process, then return a page that tells the user that their request is in progress, then periodically refresh the results page until the zip is available.

This isn't really a Perl question, so if you need further help, you might want to ask it in a forum devoted to web development.

Cheers,
Michael


On 09/05/2013 01:25 PM, Chankey Pathak wrote:
Sorry I can't do that. Isn't there any other way?


On Wed, Sep 4, 2013 at 9:48 PM, jbiskofski <jbiskof...@gmail.com <mailto:jbiskof...@gmail.com>> wrote:

    You need to fix this in Apache not in your web-app. The setting is
    called TimeOut in your httpd.conf - this is the number of seconds
    Apache will wait before sending a timeout error and ending the request.

    - Jose from Mexico.


    On Wed, Sep 4, 2013 at 4:49 AM, Chankey Pathak <chankey...@gmail.com
    <mailto:chankey...@gmail.com>> wrote:

        In my web-app there is a HTML screen which provides the facility
        to select and download documents. If user selects some documents
        (using checkbox) and submits the form then then all of his
        selected documents gets downloaded in form of a zip file. What I
        do is that I take user's selected documents and then use
        Archive::Zip to create Zip file. It works fine.

        But if the user had selected a lot of documents then the
        create_zip subroutine takes a lot of time, and if it takes more
        than 4 minutes (240 seconds) then apache timeout occurs causing
        the 503 error, but in the backend the subroutine keeps doing the
        job, but due to the timeout I can't send the created zip file to
        user's browser.

        I'm confused how to solve this problem. *How to keep the
        connection alive unless the subroutine finishes its job?*

        PS: Web-app is built using CGI.pm and Perl 5.8.5.


-- Regards,
        Chankey Pathak <http://www.technostall.com>





--
Regards,
Chankey Pathak <http://www.linuxstall.com>

--
Michael Brader                    Senior Software Engineer and Perl Person
Our World Wide Web has a World Wide Network      Technology/Softdev/DevOps
Internode       http://internode.on.net/          mbra...@internode.com.au
iiNet             http://iinet.net.au/         m.bra...@staff.iinet.net.au

Reply via email to