From bbf012364d9f1482b16c97b8bfd2fd07130446ca Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 11 Jan 2018 14:58:09 -0800 Subject: fixes #201 TLS configuration should support files for certificates and keys This adds support for configuration of TLS websockets using the files for keys, certificates, and CRLs. Significant changes to the websocket, TLS, and HTTP layers were made here. We now expect TLS configuration to be tied to the HTTP layer, and the HTTP code creates default configuration objects based on the URL supplied. (HTTP dialers and listeners are now created with a URL rather than a sockaddr, giving them access to the scheme as well.) We fixed several bugs affecting TLS validation, and added a test suite that confirms that validation works as it should. We also fixed an orphaned socket during HTTP negotiation, responsible for an occasional assertion error if the http handshake does not complete successfully. Finally several use-after-free races were closed. TLS layer changes include reporting of handshake failures using newly created "standard" error codes for peer authentication and cryptographic failures. The use of the '*' wild card in URLs at bind time is no longer supported for websocket at least. Documentation updates for all this are in place as well. --- tests/httpclient.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'tests/httpclient.c') diff --git a/tests/httpclient.c b/tests/httpclient.c index e377d334..76a3566b 100644 --- a/tests/httpclient.c +++ b/tests/httpclient.c @@ -1,5 +1,5 @@ // -// Copyright 2018 Garrett D'Amore +// Copyright 2018 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -32,21 +32,13 @@ TestMain("HTTP Client", { Convey("Given a TCP connection to httpbin.org", { nng_aio * aio; nni_aio * iaio; - nng_sockaddr rsa; nni_http_client *cli; nni_http * http; So(nng_aio_alloc(&aio, NULL, NULL) == 0); - iaio = (nni_aio *) aio; - iaio->a_addr = &rsa; + iaio = (nni_aio *) aio; - nng_aio_set_timeout(aio, 20000); - nni_plat_tcp_resolv("httpbin.org", "80", NNG_AF_INET, 0, iaio); - nng_aio_wait(aio); - So(nng_aio_result(aio) == 0); - So(rsa.s_un.s_in.sa_port == htons(80)); - - So(nni_http_client_init(&cli, &rsa) == 0); + So(nni_http_client_init(&cli, "http://httpbin.org") == 0); nni_http_client_connect(cli, iaio); nng_aio_wait(aio); So(nng_aio_result(aio) == 0); -- cgit v1.2.3-70-g09d2