views:

13

answers:

0

I have some client code which needs to call methods on a remote web service. To allow the client out through any proxy server which may be in use I'm trying to use the CAtlHttpClientT::SetProxy function which, according to MSDN:

"Calling this method causes all HTTP transactions to be routed through the given proxy server. Calling SetProxy with no arguments is recommended, because proxy server information will be retrieved from the registry instead of being hard-coded in the application."

Most of the time this seems to work just fine (I use the default arguments, as recommended), but one customer has recently stopped using a proxy server and the client can no longer contact the web service. After some investigation it turns out that SetProxy is setting the proxy to the string "proxy", or at least that's what CAtlHttpClientT::GetProxy is returning.

I've checked the registry at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet (which is where MSDN says the proxy server settings are stored) and there are no settings stored there.

So, can anyone tell me where this "proxy" value is coming from and why does it break the client? How should I deal with it? A tentative fix (which seems to work in limited testing) is to call GetProxy and if it returns "proxy" to call CAtlHttpClientT::RemoveProxy as a way of reverting back to no proxy server. Is this 'fix' valid?

On a related note, can anyone recommend any good articles which explain this from basic principles? Piecing things together from MSDN fragments can be tricky!

Feel free to ask questions.