Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-1159

HTTP Proxy Reconnect with SSL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.1.5
    • None
    • None
    • Important

    Description

      Related to: https://www.quickfixj.org/jira/browse/QFJ-997

       

      In short, HTTP(S) reconnection is not possible with a Proxy in the event the peer server shuts down.

      The check for reconnection at /org/apache/mina/proxy/ProxyConnector:

      // If proxy does not use reconnection like socks the connector's // future is returned. If we're in the middle of a reconnection // then we send back the connector's future which is only used // internally while <code>future</code> will be used to notify // the user of the connection state.
      if (proxyIoSession.getRequest() instanceof SocksProxyRequest || proxyIoSession.isReconnectionNeeded()) {
          return conFuture;
      }
       

      When a peer shuts down, the SslHandler receives a message to close the connection, and eventually destroy it (

              // Close inbound and flush all remaining data if available.
              try {
                  sslEngine.closeInbound();
              } catch (SSLException e) {
                  if (LOGGER.isDebugEnabled()) {
                      LOGGER.debug("Unexpected exception from SSLEngine.closeInbound().", e);
                  }
              }
      

      In the logs, you'll see the "Unexpected exception from SSLEngine.closeInbound()" message. The proxyIoSession.isReconnectionNeeded() will never be set to true once this happens.

       

      In AbstractHttpLogicHandler.handleResponse()), this logic also defaults to false.

      if (!isHandshakeComplete() && ("close".equalsIgnoreCase(StringUtilities.getSingleValuedHeader(response.getHeaders(), "Proxy-Connection")) || 
          "close".equalsIgnoreCase(StringUtilities.getSingleValuedHeader(response.getHeaders(), "Connection")))) {
          getProxyIoSession().setReconnectionNeeded(true);
      }
      

       

      If we change proxy type to SOCKS(4/5) we are seeing the reconnect attempt due to /org/apache/mina/proxy/ProxyConnector.java:181, but would be nice to have the same functionality for the HTTP proxy. For HTTP sessions, proxyIoSession.isReconnectionNeeded() defaults to false since it's never set in the event of Handler exception.

      I also can't see any obvious way to set the ProxyIoSession.reconnectionNeeded variable that would potentially trigger the reconnection.

      Attachments

        Activity

          People

            Unassigned Unassigned
            oakejo Johan Oakes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: