diff options
author | Jeremias Maerki <jeremias@apache.org> | 2006-04-23 12:16:54 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2006-04-23 12:16:54 +0000 |
commit | 8592c9300848f27eebd40db3a2705c08705c725f (patch) | |
tree | 0904f7638cfaf71af67d9ebfc626dceebb1c9a01 | |
parent | 23b770464a4f6a336d65fbf9e92f067fedfe3993 (diff) | |
download | xmlgraphics-fop-8592c9300848f27eebd40db3a2705c08705c725f.tar.gz xmlgraphics-fop-8592c9300848f27eebd40db3a2705c08705c725f.zip |
Bypass URI resolution for "data:" URLs (RFC 2397). If a large data URL is given to Apache XML Commons Resolver, it tries to construct a java.net.URL from it which takes forever and fails in the end when no protocol handler for "data" URLs is installed.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@396263 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/apps/FOUserAgent.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/apps/FopFactory.java | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java index 9a052b155..7fc706708 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/java/org/apache/fop/apps/FOUserAgent.java @@ -410,7 +410,9 @@ public class FOUserAgent { */ public Source resolveURI(String uri, String base) { Source source = null; - if (uriResolver != null) { + //RFC 2397 data URLs don't need to be resolved, just decode them. + boolean bypassURIResolution = uri.startsWith("data:"); + if (!bypassURIResolution && uriResolver != null) { try { source = uriResolver.resolve(uri, base); } catch (TransformerException te) { diff --git a/src/java/org/apache/fop/apps/FopFactory.java b/src/java/org/apache/fop/apps/FopFactory.java index cd1f4c4d7..a0acb36a3 100644 --- a/src/java/org/apache/fop/apps/FopFactory.java +++ b/src/java/org/apache/fop/apps/FopFactory.java @@ -571,7 +571,9 @@ public class FopFactory { */ public Source resolveURI(String uri, String base) { Source source = null; - if (uriResolver != null) { + //RFC 2397 data URLs don't need to be resolved, just decode them. + boolean bypassURIResolution = uri.startsWith("data:"); + if (!bypassURIResolution && uriResolver != null) { try { source = uriResolver.resolve(uri, base); } catch (TransformerException te) { |