public static capex.net.SSLSocket createInstance(capex.net.ConnectedSocket cSocket, string serverAddress = null, cape.LoggingContext ctx = null, cape.File certFile = null, cape.File keyFile = null, bool isServer = false, bool acceptInvalidCertificate = false, string passphrase = null) { if (!(cSocket != null)) { return(null); } capex.net.SSLSocket v = null; return(v); }
public void closeConnection(capex.http.HTTPClientListener listener) { if (!(openSocket != null)) { return; } if (listener != null) { listener.onStatus("Closing connection"); } openSocket.close(); openSocket = null; openSocketProtocol = null; openSocketAddress = null; openSocketPort = 0; parser = null; if (listener != null) { listener.onStatus(null); } }
public static capex.net.SSLSocket forServer(capex.net.ConnectedSocket cSocket, cape.File certFile = null, cape.File keyFile = null, cape.LoggingContext ctx = null, bool acceptInvalidCertificate = false, string passphrase = null) { return(capex.net.SSLSocket.createInstance(cSocket, null, ctx, certFile, keyFile, true, acceptInvalidCertificate, passphrase)); }
public static capex.net.SSLSocket forClient(capex.net.ConnectedSocket cSocket, string hostAddress, cape.LoggingContext ctx = null, bool acceptInvalidCertificate = false, string passphrase = null) { return(capex.net.SSLSocket.createInstance(cSocket, hostAddress, ctx, null, null, false, acceptInvalidCertificate, passphrase)); }
public bool openConnection(string protocol, string address, int aport, capex.http.HTTPClientListener listener) { closeConnection(listener); if (cape.String.isEmpty(address)) { if (listener != null) { listener.onError("No server address"); } return(false); } if (!(object.Equals(protocol, "http")) && !(object.Equals(protocol, "https"))) { if (listener != null) { listener.onError("Protocol must be http or https"); } return(false); } var port = aport; if (port < 1) { if (object.Equals(protocol, "https")) { port = 443; } else { port = 80; } } if (listener != null) { listener.onStatus("Connecting to server `" + address + ":" + cape.String.forInteger(port) + "' .."); } openSocket = (capex.net.ConnectedSocket)capex.net.TCPSocket.createAndConnect(address, port); if (listener != null) { listener.onStatus(null); } if (openSocket == null) { if (listener != null) { listener.onError("Connection failed: `" + address + ":" + cape.String.forInteger(port) + "'"); } return(false); } if (object.Equals(protocol, "https")) { openSocket = (capex.net.ConnectedSocket)capex.net.SSLSocket.forClient(openSocket, address, null, acceptInvalidCertificate); if (openSocket == null && listener != null) { listener.onError("FAILED to create SSL socket for HTTPS"); closeConnection(listener); return(false); } } openSocketProtocol = protocol; openSocketAddress = address; openSocketPort = port; parser = new capex.http.HTTPClientOperation.MyResponseParser(); return(true); }
public capex.net.IOManagerDotNetSelect.MyEntry setSocket(capex.net.ConnectedSocket v) { socket = v; return(this); }