Skip to content

Instantly share code, notes, and snippets.

@hjcotton
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hjcotton/3b5943fefd666d08e51d to your computer and use it in GitHub Desktop.
Save hjcotton/3b5943fefd666d08e51d to your computer and use it in GitHub Desktop.
<!--- Fixes POPCFC (http://popcfc.riaforge.org/) socket.cfc read() timing out when connecting over SSL.
Source: http://stackoverflow.com/questions/29778233/not-getting-a-response-when-communicating-with-google-using-java-sslsocket --->
<cfloop condition="not locInput.ready()">
<cfset sleep(1)> <!--- take a breather --->
<cfif timeout LT getTickCount()>
<!--- if we're here we haven't had a response from the server --->
<cfthrow message="Connection Timed out." detail="The connection did not receive a response within the timeout period.">
</cfif>
<!--- HC: Fix SSL socket connections timing out due to the BufferedReader (locInput) never reporting itself as ready(). --->
<cfif getProperty("UseSSL")>
<!--- SSL connections will not be reported as "ready" by the BufferedReader until a read()/readLine() has been triggered first. --->
<cfset outputStream.write(locInput.read())>
</cfif>
</cfloop>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment