AW: [Xml-compile] Make sure not to block, like on loading external
DTDs
Patrick Powell
papowell at astart.com
Tue Feb 21 19:13:36 GMT 2012
On 02/21/12 05:25, Michael Ludwig wrote:
>> Von: Mark Overmeer
>> * Michael Ludwig (m.ludwig at epages.com) [120221 10:43]:
>>> Now I haven't debugged this, but under some circumstances
>>> there's a long wait because something tries to get the HTML
>>> DTD from the W3C website, and they have you wait deliberately
>>> so you learn not to load the DTD from their site, and why
>>> would you?
>> Ah, so when the answer is not XML and then you pretty_print
>> the response body, you get this delay. Maybe we should refuse
>> pretty-printing anything else than xml...
> That wouldn't help for the (admittedly) odd case where the service
> returns an XML document including a DOCTYPE pointing you to a DTD.
> Or simply supplies a wrong Content-Type in HTTP. Odd cases indeed,
> but then, real life computing has lots of them.
>
>>> my %opt = (load_ext_dtd => 0, recover => 1);
>>> no_network => 1
>>> XML::LibXML->load_xml(location => shift, %opt)->toFH(*STDERR, 1);
>> patch applied twice.
> Thanks. Best,
>
> Michael
>
> _______________________________________________
> Xml-compile mailing list
> Xml-compile at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile
>
>
I ran into the same set of problems and 'solved' it by brutally
modifying the
place in where this problem is detected and using Data::Dumper to
print/dump the entire '$trace' object and then looking at the output.
At least I could see what happened. $trace is VERY useful.
This method is brutal, nasty, and really really ugly. But hey! So are some
of the legacy SOAP applications.
I would really like to have an option, say 'dump_trace_on_bad_reply' flag
that we could turn this dumping on and off... so that we don't fill up the
log file.
Here is a DIFF showing the change that I made.
YMMV... NFFAP... etc etc....
diff XML-Compile-SOAP-2.25/lib/XML/Compile/Transport/SOAPHTTP.pm to the
original SOAPHTTP.pm
*** /tmp/SOAPHTTP.pm.mod Tue Feb 21 11:06:31 2012
--- /tmp/SOAPHTTP.pm.other Tue Feb 21 11:06:31 2012
***************
*** 210,217 ****
info "received ".$response->status_line;
$ct =~ m,[/+]xml$,i
! or error __x"answer is not xml but `{type}'", type => $ct;
# HTTP::Message::decoded_content() does not work for old Perls
my $content = $] >= 5.008 ? $response->decoded_content(ref => 1)
--- 210,223 ----
info "received ".$response->status_line;
+ # CHANGE papowell at astart START
+ {
+ use Data::Dumper;
+ local $Data::Dumper::Indent = 1;
$ct =~ m,[/+]xml$,i
! or error __x"answer is not xml but `{type}'
".Dumper($response), type => $ct;
! }
! # CHANGE papowell at astart END
# HTTP::Message::decoded_content() does not work for old Perls
my $content = $] >= 5.008 ? $response->decoded_content(ref => 1)
--
Patrick Powell Astart Technologies
papowell at astart.com 1530 Jamacha Road, Suite X,
Network and System El Cajon, CA 92019
Consulting 858-874-6543
Web Site: www.astart.com
More information about the Xml-compile
mailing list