Search code examples
httpsdartredstone.dart

Dart / Redstone - HTTPS Connection


Good Morning,

I have a problem, I want to make a HTTPS connection, between my API’s and my server. I use Dart with a Redstone Dart layer. All my certificates are validated.

I use the RedStone function’s: start (); to make this connection.

But I have an error during the connection.

INFO: 2016-01-25 02:26:09.789: Using a secure connection with options: {Symbol("certificateName"): CN=RedStone, Symbol("context"): Instance of '_SecurityContext'}

Unhandled exception: Closure call with mismatched arguments: function 'call'

NoSuchMethodError: incorrect number of arguments passed to method named 'call' Receiver: Closure: (dynamic, int, SecurityContext, {backlog: int, v6Only: bool, requestClientCertificate: bool, shared: bool}) => Future from Function 'bindSecure': static. Tried calling: call("0.0.0.0", 9000, certificateName: "CN=RedStone", context: Instance of '_SecurityContext', shared: false) Found: call(address, port, context, backlog, v6Only, requestClientCertificate, shared) »

This is my code snippet:

SecurityContext serverContext = new SecurityContext()
  ..useCertificateChain(localFile('certificates/server_chain.pem'))
  ..usePrivateKey(localFile('certificates/server_key.pem'),
  password: 'test');
var secureOptions = {#certificateName: "CN=RedStone", #context: serverContext};

app.setupConsoleLog(Level.INFO);

app.start(port:9000, secureOptions: secureOptions);

I have put the right parameters, and I don’t understand why it still giving me an error.

If someone, can help me?

Thanks you


Solution

  • This is a bug in Redstone right now (0.6) I'll make a patch and make a release ASAP. Thanks for reporting this.