472,969 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,969 software developers and data experts.

Perl, Oracle, LWP, and PDF's

I'm working on a Perl gatekeeper for report requests on an Oracle web
app

Essentially, the code is:

if (invalid request)
{ burp; }
else
{ print report; }

print report is the last thing not quite working - everything else is
great

here's the problem - if the user requests a PDF version of the report,
if I print "Content-type: application/pdf" before printing the URL,
they get a popup that says "This page contains both secure and
non-secure objects...blahblahblah" and it doesn't matter if they
select Yes or No, the report comes up just fine

if I don't include the headers, a 500 Internal Server Error results,
because it tries to grab the content-type headers from the PDF and it
doesn't know what to do with "%PDF-1.1"

include the headers or not, if the user selects the HTML version of
the report, no errors and the report comes up fine

i don't know if it's *what* I'm printing or *that* I'm printing, but
any direction/insight anyone can provide is greatly appreciated

i've included the "print report;" code below

Thanks
JDV

use LWP::UserAgent;
use HTTP::Headers;

$good_url = "https:".$server."ows-bin/rwcgi60.exe?".$in;
my $req = HTTP::Request->new(GET => $good_url);

if ($rep_format eq 'HTML')
{ $req->header('Content-type' => 'text/html');}
if ($rep_format eq 'PDF')
{ $req->header('Content-type' => 'application/pdf');}
if ($rep_format eq 'DELIMITED')
{ $req->header('Content-type' => 'text/plain');}

my $res = $ua->request($req);
$res->header('Content-type' => $req->header('Content-type'));

if ($res->is_success)
{
print 'Content-type: '.$res->header('Content-type');
print "\n\n";
print $res->content;
}
else
{ print "Error: " . $res->status_line . "\n"; }
--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html

Jul 19 '05 #1
1 4267
In comp.infosystems.www.authoring.cgi JD Vernon <jd**********@hotmail.com> wrote:
I'm working on a Perl gatekeeper for report requests on an Oracle web
app

Essentially, the code is:

if (invalid request)
{ burp; }
else
{ print report; }

print report is the last thing not quite working - everything else is
great

here's the problem - if the user requests a PDF version of the report,
if I print "Content-type: application/pdf" before printing the URL,
they get a popup that says "This page contains both secure and
non-secure objects...blahblahblah" and it doesn't matter if they
select Yes or No, the report comes up just fine
For an experiment, try saving the PDF to a file on the server, then in your
request, forget the whole UserAgent stuff. (Comment out the 'use
LWP::UserAgent' and 'use HTTP::Headers;' lines to prove those libraries
aren't used.

Then open the PDF file and send it out. (this would guarantee it has
nothing to do with any "magic" perl is doing in the
"$res->header('Content-type');" bit. You might also just telnet to the
server on port 80 to see if you're given an errant 'Location' header or
something weird like that. (as crazy and unlikey as this sounds, it'd be
nice to rule it out)

If it still gives errors after directly sending out the file, try locating
another PDF some place that doesn't give you the error, or try another
browser.

It could be that the helper application for PDF's triggers the error, could
try setting it to "application/octet-stream" to see if the browser still
chokes on it. (Browser might percieve any type of data that it can't handle
as potentially accessing insecure data, in which case there is very little
you can do about it) I suspect this is the case.

It's probably unlikely, but the browser could be looking at the PDF version
to see if it's capable of using external resources? in that case, you'd
probably have to know about PDF details, perhaps there is an older PDF
standard that doesn't support external linking but still supports your
needs. When you're testing with the "open via file and raw dump to browser"
you could try sending an older PDF to see if that works. (then cross your
fingers you can retrieve the PDF in this older format...)

Are you using a plugin for the PDF or a helper application? If it's a
plugin, try switching to "helper application".

Those are the areas I'd look in, though perhaps not in that order.

Jamie

Thanks
JDV

use LWP::UserAgent;
use HTTP::Headers;

$good_url = "https:".$server."ows-bin/rwcgi60.exe?".$in;
my $req = HTTP::Request->new(GET => $good_url);

if ($rep_format eq 'HTML')
{ $req->header('Content-type' => 'text/html');}
if ($rep_format eq 'PDF')
{ $req->header('Content-type' => 'application/pdf');}
if ($rep_format eq 'DELIMITED')
{ $req->header('Content-type' => 'text/plain');}

my $res = $ua->request($req);
$res->header('Content-type' => $req->header('Content-type'));

if ($res->is_success)
{
print 'Content-type: '.$res->header('Content-type');
print "\n\n";
print $res->content;
}
else
{ print "Error: " . $res->status_line . "\n"; }

--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Keith | last post by:
All: What is the difference between Perl (CGI) and PHP (Apache module)? I thought both used servers to direct the user to the appropiate Perl or PHP program in order to execute the program to...
25
by: rbt | last post by:
Are there any plans in the near future to support PDF files in Python as thoroughly and completely as Perl does? http://cpan.uwinnipeg.ca/search?query=pdf&mode=dist I love Python's clean...
1
by: Anju Patel | last post by:
We installed Oracle security patch CPUJan2006 on Feb 23. Today we cannot run our jobs. We are getting following error: install_driver(Oracle) failed: Can't load...
1
by: byrapaneni | last post by:
Hello all; I gathered information from this and several other groups to write a perl & cgi script to display a pdf document. My script works partially and found an issue when testing. Here is...
4
by: billb | last post by:
I installed a perl extension for PHP to use some perl inside my php primarily because I have perl working with oracle and not php and oracle. So I want to use my old perl scripts, and use the...
3
by: hakiran | last post by:
Hello all, I have been using Perl DBI the last 6months or so. I use it extensively with MySQL. But recently i tried to access Oracle DB with it and was having trouble. Any help would be...
3
by: andrewkl | last post by:
hi, I have the following Perl code that inserts a string to an Oracle DB via a stored procedure: #!/usr/local/bin/perl ## Perl v5.8.6 built for sun4-solaris use strict; BEGIN...
1
by: megaman1 | last post by:
I’m trying to connect with perl DBD::Oracle on Windows to Oracle DB (Linux). I compiled the Oracle.dll using the commands “perl Makefile.pl” “nmake” and “nmake install”, but when I try to connect...
3
by: Dick Sutton | last post by:
First of all, I am a rank amateur at Perl. Here is my problem: I have a hundred or more files in a directory on a web server (let's call it 'Library'). Each file is a pdf file and is named...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.