-
Notifications
You must be signed in to change notification settings - Fork 655
Description
We are trying to connect over an HTTP proxy that enforces authentication, i.e. user and password need to be set. But even though we put them into the dictionary (and set the appropriate proxy type and the correct proxy host and port) the connection fails.
Snooping into the network traffic with wireshark reveals that, at first, a CONNECT request is sent by our application to the proxy. As usual, this initial request contains no authentication data, and is answered by the proxy with an 407 Authentication Required. The expected behaviour would be that a new CONNECT request is send, this time with a Basic Proxy-Authorization header containing the user and password. Instead, the connection is closed.
I ran the code in a debugger and found that the problem seems to be that in quickfix.mina.ProtocolFactory (line 145 to 150) a prefered order of the authentication methods is set into the proxyIoSession. This order, however, has NO_AUTH at the first position. So that, after receiving the 407 and when going through the possible authentication methods, Mina's HttpSmartProxyHandler first encounters a NO_AUTH and sees this as a sign that every further search for an authentication method is futile. And therefore closes the connection.
The prefered order of the authentication methods in ProtocolFactory seems to be rather obviously wrong. But instead of correcting it, you might want to just not set it, in which case Mina would go with their own idea of which method to prefer, which seems to be a good idea.
I forced the prefered order list to be null in my debugger, and was able to succesfully connect through the proxy.