Subject: | S3.pm: _remember_errors tries to parse non-xml |
the _remember_errors subroutine tries to parse errors even if the
content type is not XML. This results in a hard death when libxml
encounters the parse error and prevents retry from functioning.
Inserting the following code at the beginning of _remember_errors makes
it work, but it is not exactly elegant as it doesn't check the
content-type, just inspects the content for an opening <. Ideally
_remember_errors would be called with a full response that includes
content type, or would be restricted to being called only with XML or
xpc references.
# Do not try to parse non-xml
unless (ref $src || $src =~ m/^[[:space:]]*</ ) {
(my $code = $src) =~ s/^[[:space:]]*\([0-9]*\).*$/$1/;
$self->err($code);
$self->errstr($src);
return 1;
}