RE: Help on debugging print problem

"Chris Faust" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <05d701ce5d4d$e70b8580$b5229080$@com>
Thanks Marcus, is there is a easy way to get the content length?

 

I tried

 

$length = calculate_body_len();

$r->err_headers_out->add('Content-Length' => $length);

 

Which gave me a corrupted content error, I also tried

 

my $body_len = calculate_body_len();

$r->set_content_length($body_len);

$r->rflush;

 

Which just did nothing.

 

Thx

-Chris

 

From: Marcus Don [mailto:[email protected]] 
Sent: Thursday, May 30, 2013 9:12 AM
To: Chris Faust
Cc: [email protected]
Subject: Re: Help on debugging print problem

 

At a guess, I'd say your new machine is using chunked output, so you might
need to add a size header.

 

Marcus

 

 

On 30 May 2013, at 12:11, "Chris Faust" <[email protected]> wrote:





Hi,

 

I have some code I use all the time I use to download a file:

 

if (-e '/report.pdf') {

                open(PDF, '/report.pdf') or die "could not open PDF $!";

                binmode PDF;

                my $output = do { local $/; <PDF> };

                close(PDF);

                $r->content_type('application/pdf');

                $r->err_headers_out->add('Content-Disposition' =>
'attachment; filename="report.pdf"');

                $r->print($output);

}

 

I've never had a problem before using the above until trying to do it on a
new machine. On that machine every time I still get prompted to download the
file but FF/IE says its only 20 bytes (even though the pdf is 200k on the
file system) and what is downloaded is not what is on the filesystem.

 

I tried different files, different paths etc with the same results so I
don't think it's a location or permissions issue.

 

The only thing that gets logged in the attempt is:

 

TIGHT LOOP!!!: Apache2::RequestRec=SCALAR(0x47e2f78) can't
Apache2::RequestRec::print!

 

Any ideas how I could further debug that error to find the cause?

 

TIA!

-Chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.