Subsequent connections with HTTPSecure Socket not working

I have a simple example using a HTTPSecureSocket control, and I’m successfully requesting “https://www.google.com” securely (i.e. the “SSLConnected” property is true when the “Connected” event fires) with “Get”. This consistently works right after I run my test app. However, if I use the same code to request the same page a second time, this no longer works. The “Connect” event fires, but the “SSLConnected” property is not true, and the “PageReceived” even fires, but the contents are empty. And it won’t work until I restart the app. Has anybody else experienced this? Please note that I’m on firewalled network that requires a proxy to connect. Below is the code I’m using (proxy address redacted):

DataSocket.HTTPProxyAddress = "********" DataSocket.HTTPProxyPort = 8081 DataSocket.ConnectionType = SSLSocket.TLSv1 DataSocket.Secure = true DataSocket.Get("https://www.google.com")

The DataSocket is a HTTPSecureSocket control dragged into the main window of the test app. As mentioned above, this code works the first time after the app starts, but not for any subsequent times. Also worth noting is that if I set the “Secure” property to false and request “http://www.google.com” instead, the above code works every time it is executed.

I’m not seeing that. I get the same results every time.

Hmm, so do I, at home, where I’m not going through a proxy. It appears the proxy has something to do with this, but I can’t tell if the problem is with the proxy, or with my app. Have you tried this using a direction connection, or using a proxy?

Check the HTTPStatus. If it’s 304, the proxy is telling you that nothing has changed. it would not surprise me if your proxy at work has its own cache to cut down on bandwidth requirements.

HTTPStatus is 200 after the first connection and 0 after each subsequent connection. Weird.

I found a workaround. Making DataSocket a property of the window instead of dragging a control to the window and initializing it each time seems to get around the issue, i.e. adding 2 lines at the beginning of the test code makes this example work with the proxy.

DataSocket = nil DataSocket = new DataSocket DataSocket.HTTPProxyAddress = "********" DataSocket.HTTPProxyPort = 8081 DataSocket.ConnectionType = SSLSocket.TLSv1 DataSocket.Secure = true DataSocket.Get("https://www.google.com")

This doesn’t explain where the problem lies (the proxy or the HTTPSecureSocket implementation in Xojo). So, if anybody reading this lives in an environment where they need to go through a proxy, it would be great if they could try this out (with and without initializing the socket before making a connection).

Just FYI, you don’t need

DataSocket = nil