I recently got a number of bug reports that
in certain situations RSS Bandit would report
a proxy authentication error when fetching certain RSS feeds over the Web when
connecting through a proxy server. It seemed most feeds would work fine
but a particular set of feeds would result in the following message
The remote server returned an error: (407) Proxy Authentication Required.
Examples of sites that had problems include the feeds for Today
on Java.net, Martin Fowler`s
bliki and Wired
News. It dawned on me that the one the one thing all these feeds had in common
was that they referenced a DTD. The problem was that although I was using an instance
of the System.Net.IWebProxy interface
in combination with an HttpWebRequest when
fetching the RSS feed I did not provide the XmlValidatingReader used
to process the feed that it should use the proxy information when resolving DTDs.
This is where things got less intuitive. All XmlReaders have an XmlResolver
property used to retrieve resources external to the file. However the XmlResolver
class does not provide a way to specify proxy information, only authenticattion information.
To solve this problem I had to create a subclass of the XmlResolver class which
used the proxy connection when retrieving external resources. It seems I`m not the
only person who`s come up across this problem and the solution was presented on the
microsoft.public.dotnet.xml newsgroup a while ago in the thread entitled XmlValidatingReader,
XmlResolver, Proxy Authentication, Credentials, Remote schema. This post shows
how to create a custom XmlResolver which utilizes proxy information and how to use
this class to prevent the errors I was seeing.
I checked in the fix to RSS Bandit this morning, so very soon a number of
users of the most sophisticated news aggregator on the Windows platform will be very
happy campers seeing this annoying bug fixed.