$Sock_SSL_On
Switch to SSL processing
Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is currently no direct OO equivalent for this $function.
$Sock_SSL turns on SSL processing, that is, starts an SSL handshake as a client on a connection.
Syntax
[%rc =] = $Sock_SSL_On(sockNum)
Syntax terms
%rc | A numeric return code: 0 if successful, otherwise a negative value, as described below. |
---|---|
sockNum | The socket number, or it is -1, which indicates that the change affects all relevant sockets. |
$Sock_SSL_On return codes
$Sock_SSL_On return codes are:
Usage notes
This function makes it possible to make an initial connection from a Janus Sockets client application to a proxy server, use the CONNECT method to connect to a server through the proxy, and then communicate via SSL with the back end server, simply having the proxy server act as a "tunnel" for the SSL data. Basically, $Sock_SSL_On should be used after a positive response has been received for a CONNECT method request on a Janus Sockets client socket.
Example
The following code illustrates the use of $Sock_SSL_On:
%x = $Sock_Conn('WEBDROPS', 'proxy') %r = $Sock_Set(%x, 'LINEND', '0D0A') %r = $Sock_Set(%x, 'PRSTOK', '0D0A') %r = $Sock_Send(%x, 'CONNECT ') %r = $Sock_Send(%x, 'sirius-software.com:443') %r = $Sock_SendLn(%x, ' HTTP/1.0') %r = $Sock_SendLn(%x, ) %r = $Sock_RecvPrs(%x, %s) If $WORD(%s, , 2) Ne '200' Then Call CONNECT_ERROR End If Repeat Forever %r = $Sock_RecvPrs(%x, %s) If $lstr_len(%s) Eq 0 Then Loop End End If End Repeat %r = $Sock_SSL_On(%x) If %r Then Call SSL_ERROR End If %r = $Sock_Send(%x, 'GET ') %r = $Sock_Send(%x, %URL) %r = $Sock_SendLn(%x, ' HTTP/1.0') %r = $Sock_SendLn(%x, ) ...
For more information about HTTP tunneling and the CONNECT method, see http://www.ietf.org/rfc/rfc2817.txt
. Many other references are also available on the web.
0 | Successfully switched to SSL. |
---|---|
-110 | Attempted on non-SSL port. $Sock_SSL_On can only be attempted on a port with SSL and SSLOPT on the JANUS DEFINE command. |
-111 | SSL handshake error. Likely result of trying to use $Sock_SSL_On against a non-SSL port. |
-112 | Have pending incoming data. $Sock_SSL_On is invalid until all incoming (presumably) non-SSL data has been received. |
-149 | Other error during connection. |