Forum How do I...?

Prince and SSL

dorianwinterfeld
I have the same Prince app running on four different development Windows/IIS servers. Two are wide open (behind a firewall), one is password protected and one is password protected and has SSL. It works fine on the first three but fails on the server w/ SSL. This is my Prince command in Perl:

$princecmd = 'C:\Progra~1\Prince\Engine\bin\prince.exe';
if (! open(PRINCE, "| $princecmd --baseurl=$baseurl --http-user=$user --http-password=$pass --no-embed-fonts --no-subset-fonts --ssl-blindly-trust-server -")){
print "Error starting Prince\n";
exit;
}
print PRINCE $html || die "can't write to prince; $!";
close(PRINCE);

this is the error message returned from Prince:

prince: http://www.w3.org/TR/html4/strict.dtd:81: error: xmlParseEntityDecl: entity ContentType not terminated prince: http://www.w3.org/TR/html4/strict.dtd:81: error: Content error in the external subset prince: -:11: error: Opening and ending tag mismatch: META line 3 and HEAD prince: -:11: error: AttValue: " or ' expected prince: -:11: error: attributes construct error prince: -:11: error: Couldn't find end of Start Tag TABLE line 11 prince: -:21: error: Opening and ending tag mismatch: br line 21 and h2 prince: -:30: error: Opening and ending tag mismatch: hr line 22 and TD prince: -:30: error: Opening and ending tag mismatch: h2 line 21 and TR prince: -:30: error: Opening and ending tag mismatch: hr line 15 and TABLE prince: -:30: error: Opening and ending tag mismatch: TD line 11 and BODY prince: -:30: error: Opening and ending tag mismatch: TR line 11 and HTML prince: -:31: error: Premature end of data in tag BODY line 11 prince: -:31: error: Premature end of data in tag HEAD line 2 prince: -:31: error: Premature end of data in tag HTML line 2 prince: -: error: could not load input file prince: error: no input documents to process

It looks like the html is not well formed but it's the exact same html that I am passing the other servers that work. I suspect that SSL is the problem, I used --ssl-blindly-trust-server. Am I missing something?

thanks - dorian@uaqa.com
mikeday
Prince seems to be trying to load the HTML 4 DTD from the W3C server, which is an SGML DTD and not XML at all. Is your document an XML document that referents the HTML 4 DTD in its <!DOCTYPE> declaration?
dorianwinterfeld
hmmm.... I think I see what is happening. This is the doctype that *should* be piped to prince:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

but instead it's getting:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

from "You are not authorized to view this page". So prince is not getting the correct input document. I'm using LWP::UserAgent to grab the document source. This passes the credentials for the password protection. It works on the server with User Authentication but w/o SSL. So I assume that LWP::UserAgent can't negotiate the SSL. I'll write to the Perl Monks. Thanks for jarring my thought process.