nite_man has asked for the wisdom of the Perl Monks concerning the following question:

Dear brothers and sisters!

I've tried to port my application from Apache to Apache2. All are working correctly but I cannot send PDF file in the browser plug-in.

In case, mod_perl (one, of course) this process was described in details in the mod_perl cookbook. But I didn't find any solution for mod_perl2.

Maybe someone can help me to resolve my problem, because I don't have enough time for detail study mod_perl2, Apache2 etc. I need to port my application as fast as possible!

Thanks in advanced!

-- Michael Stepanov

Replies are listed 'Best First'.
Re: Send PDF into browser plug-in
by simon.proctor (Vicar) on Oct 20, 2003 at 08:06 UTC
    Sending files over usually involves setting or manipulating the content-disposition header. I would first start there ensuring that its set, set correctly and that it gets set correctly with each file request (ensuring there are no caching issues with vars under mod_perl).

    After that I would say, imho, that if you are getting the save as dialog and not the browser displaying directly then frankly you have succeeded. Its upto the client, not the server, how the client deals with the data it requests.

    HTH,

    SP
Re: Send PDF into browser plug-in
by antirice (Priest) on Oct 20, 2003 at 08:21 UTC

    Fair enough:

    # in your httpd.conf PerlModule Apache::compat # or in your startup.pl use Apache::compat;

    Note that there will be overhead for using this module, however, it should allow *most* of your 1.x mod_perl code work under mod_perl 2.0 (ok... 1.99). You may also want to read A reference to mod_perl 1.0 to mod_perl 2.0 Migration.

    Hope this helps.

    antirice    
    The first rule of Perl club is - use Perl
    The
    ith rule of Perl club is - follow rule i - 1 for i > 1

      Thank you, but I've already read this reference. And using Apache::compat is not good solution because later I will have to run my application without this module.

      -- Michael Stepanov

Re: Send PDF into browser plug-in
by Roger (Parson) on Oct 20, 2003 at 07:47 UTC
    Can you describe a bit more about the problem you are experiencing?

    I think your problem could be that the browser pop's up a "Save or Open" dialog box when it receives the PDF?

    It could mean that the mime-type in the Content-type in the HTML header is wrong. Check your content type by running the CGI script on the command-line and redirect its output to a temporary file.

      I know it, thanks. Problem is in method sendfile(<FILE HANDLER>)( it replaced method send_fd(<FIEL HANDLER>)). This method returns 2 and doesn't send file into browser.

      -- Michael Stepanov

Re: Send PDF into browser plug-in
by nite_man (Deacon) on Oct 20, 2003 at 12:33 UTC

    I'm sorry for my question. I found what was problem. Function sendfile() needs only file name as parameter, but old function send_fd needed a file handler.

    -- Michael Stepanov