[issue2124] xml.sax and xml.dom fetch DTDs by default
Damien Neil
report at bugs.python.org
Tue Feb 3 23:43:01 CET 2009
Damien Neil <neild at misago.org> added the comment:
I just discovered another really fun wrinkle in this.
Let's say I want to have my entity resolver return a reference to my
local copy of a DTD. I write:
source = xml.sax.InputSource()
source.setPublicId(publicId)
source.setSystemId(systemId)
source.setCharacterStream(file(path_to_local_copy))
return source
This will appear to work.
However, the parser will still silently fetch the DTD over the network!
I needed to call source.setByteStream()--character streams are silently
ignored.
I'd never have noticed this if I hadn't used strace on my process and
noticed a slew of recvfrom() calls that shouldn't have been there.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2124>
_______________________________________
More information about the Python-bugs-list
mailing list