New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SocketIOException: Unexpected handshake error in client #7541
Comments
This comment was originally written by kaisellgren@gmail.com On Windows 7 x64 the VM crashes. I am using "Dart VM version: 0.2.9.9_r16323 (Wed Dec 19 10:26:33 2012)". |
This comment was originally written by af...@google.com Same on linux x64. Dart Editor version 0.2.9_r16323 |
The SecureSocket library needs to be initialized explicitly before using secure networking. We are working on making it initialize automatically the first time you use it, but that is not committed yet. To use just the default root certificates (well known certificate authorities), call SecureSocket.initialize() Optional parameters to .initialize() let you specify a certificate database (a directory containing cert9.db and key4.db), and whether or not to use the builtin well-known authorities. Set owner to @whesse. |
This comment was originally written by douglas....@gmail.com Thank you. Adding SecureSocket.initialize() solved the problem. |
I just committed a change that makes initialization automatic, so now it is not required (but recommended) that you call SecureSocket.initialize(). |
This comment was originally written by af...@google.com Awesome, thanks for the fast turnaround. |
SecureSocket.initialize() is now optional. If you don't call it, it is the same as if you had called it with no parameters. If you call it explicitly, you must do so once, and before creating any secure connections. You need to call it explicitly if you are making server sockets, since they need a certificate database and a password for the key database. Added Fixed label. |
Removed Area-IO label. |
This issue was originally filed by douglas....@gmail.com
What steps will reproduce the problem?
I ran the following code in a dart editor:
String url = "https://www.google.com";
HttpClient client = new HttpClient();
HttpClientConnection conn = client.getUrl(new Uri(url));
conn.onResponse = (HttpClientResponse resp) {
print ('content length ${resp.contentLength}');
print ('status code ${resp.statusCode}');
InputStream input = resp.inputStream;
input.onData = () {
print(codepointsToString(input.read()));
};
input.onClosed = () {
print('closed!');
client.shutdown();
};
};
What is the expected output? What do you see instead?
I expected an output showing the html of google.com. Instead I receive the following exception.
SocketIOException: Unexpected handshake error in client (OS Error: errno = -12268)
#0 _SecureFilterImpl.handshake (dart:io-patch:849:8)
#1 _SecureSocket._secureHandshake (dart:io:7382:28)
#2 _SecureSocket._secureConnectHandler._secureConnectHandler (dart:io:7294:21)
#3 _Socket._updateOutHandler.firstWriteHandler (dart:io- patch:773:64)
#4 _SocketBase._multiplex (dart:io-patch:408:26)
#5 _SocketBase._sendToEventHandler.<anonymous closure> (dart:io-patch:509:20)
#6 _ReceivePortImpl._handleMessage (dart:isolate-patch:37:92)
What version of the product are you using? On what operating system?
I am using version M2 of Dart on a Mac OSX operating system.
Please provide any additional information below.
If I change the code to read from "http" instead of "https", I recieve the expected output.
The text was updated successfully, but these errors were encountered: