Skip to content
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

Closed
DartBot opened this issue Dec 20, 2012 · 8 comments
Closed

SocketIOException: Unexpected handshake error in client #7541

DartBot opened this issue Dec 20, 2012 · 8 comments
Assignees
Labels
area-library library-io P1 A high priority bug; for example, a single project is unusable or has many test failures

Comments

@DartBot
Copy link

DartBot commented Dec 20, 2012

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.

@DartBot
Copy link
Author

DartBot commented Dec 20, 2012

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)".

@DartBot
Copy link
Author

DartBot commented Dec 20, 2012

This comment was originally written by af...@google.com


Same on linux x64.

Dart Editor version 0.2.9_r16323
Dart SDK version 0.2.9.9_r16323

@whesse
Copy link
Member

whesse commented Dec 20, 2012

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()
in your main() routine, before you do any networking.

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.
Removed Priority-Medium label.
Added Priority-High, Area-IO, Accepted labels.

@DartBot
Copy link
Author

DartBot commented Dec 20, 2012

This comment was originally written by douglas....@gmail.com


Thank you. Adding SecureSocket.initialize() solved the problem.

@whesse
Copy link
Member

whesse commented Dec 20, 2012

I just committed a change that makes initialization automatic, so now it is not required (but recommended) that you call SecureSocket.initialize().

@DartBot
Copy link
Author

DartBot commented Dec 20, 2012

This comment was originally written by af...@google.com


Awesome, thanks for the fast turnaround.

@whesse
Copy link
Member

whesse commented Dec 20, 2012

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.

@kevmoo
Copy link
Member

kevmoo commented May 14, 2014

Removed Area-IO label.
Added Area-Library, Library-IO labels.

@DartBot DartBot added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures area-library library-io labels May 14, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-library library-io P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

3 participants