fix some bugs in AsyncSSLSocketTest Summary: A couple of the test functions in AsyncSSLSocketTest maintained two EventBase objects and alternated looping between them. In some cases it would call EventBase::loopOnce() even when there was no work to do. This call normally blocks until an event is ready. This happened to work when using libevent1, but this appears mostly accidental: with libevent1 EVLOOP_ONCE causes the loop to break out even after an "internal" I/O event; in libevent2 EVLOOP_ONCE only breaks out after a non-internal event has occurred: https://github.com/libevent/libevent/commit/0617a818204397790e5e4c9bcb9e91ae5ea7817a In these tests it turns out that the internal EventBase NotificationQueue always gets triggered the very first time loopOnce() is called, preventing these tests from hanging when using libevent1. This fixes the hang when using libevent2 by removing the initial loopOnce() calls that potentially have nothing to do. This also consolidates the 2 EventBase objects into one to avoid having to alternate loopOnce() calls between them without knowing which one actually has work to do. This also fixes an issue where the code never checked the return value of `recv()` Reviewed By: yfeldblum, siyengar Differential Revision: D6735669 fbshipit-source-id: 5f36106a08866aa8908e82263f83a606399cdf79
Fix copyright lines Summary: [Folly] Fix copyright lines based on file histories. Reviewed By: spalamarchuk Differential Revision: D6720312 fbshipit-source-id: c70a667a1977e70e2d4451ea624f96163982f681
Fix build with Windows SDK v10.0.16232 Summary: It defines `MSG_ERRQUEUE` which breaks things. There's a github PR to do this in a different way, but it's faster to just do it myself. Closes https://github.com/facebook/folly/pull/689 Reviewed By: yfeldblum Differential Revision: D6155606 fbshipit-source-id: f1c6b247efc452b4005ad3b6d82fabfd5a92f49f
Consistently have the namespace closing comment Summary: It's done in a lot of places, but not all. clang-tidy gives us llvm-namespace-comment, which can force this consistently. Reviewed By: yfeldblum Differential Revision: D6108129 fbshipit-source-id: 1b44c5a26250364f9edf70f84173e9ba6389f06c
AsyncSSLSocket::get/setClientCertValidationResult API. Summary: The added API will be used for storing and retrieving validation result of client cert. At some point we may change "client" to "peer" to make it generic. Reviewed By: anirudhvr Differential Revision: D5610404 fbshipit-source-id: 2feb03abc0594af4c68db33d8885ea214867148a
Test server-side getPeerCert(). Summary: Make sure server can get client cert using AsyncSSLSocket::getPeerCert() call. Reviewed By: anirudhvr Differential Revision: D5557303 fbshipit-source-id: d95696f592e3b3f67acba9f92add32b91c29a000
Clang-format AsyncSSLSocketTest.cpp. Summary: ... as titled. Reviewed By: yfeldblum Differential Revision: D5558742 fbshipit-source-id: b63b121cde8db93de4cabc80563539297611d600
Consistency in namespace-closing comments Summary: [Folly] Consistency in namespace-closing comments. Reviewed By: Orvid Differential Revision: D5524744 fbshipit-source-id: ced4dd2398ed6baa3ad5b68b74eee6a5d6b2b103
Fix the build of the socket tests on Windows Summary: There were references to things that don't exist or have an equivalent on Windows. Reviewed By: yfeldblum Differential Revision: D5099802 fbshipit-source-id: 9a5a2d0e5cb3a33ecad00bf8a2e1c13315a015cc
AsyncSSLSocket connect without SSL Summary: Currently when calling connect with AsyncSSLSocket in unencrypted mode it still attempts to perform a SSL handshake. Add check to not do SSL. Calling sslConnect will always run the SSL handshake Reviewed By: jrahman Differential Revision: D5153456 fbshipit-source-id: 4d9164115be72c8ee76e383535561e3083a327e3
Add a version of async_test using openssl 1.1.0 Summary: Now that it's possible, let's add some 1.1.0 tests to avoid regressing 1.1.0 support Reviewed By: yfeldblum Differential Revision: D5167246 fbshipit-source-id: ba12414504131697d4e0757c9c340a66f810acd4
apply clang-tidy modernize-use-override Summary: This is generated by applying clang-tidy -checks=modernize-use-override to all .cpp files under folly. It enforces the use of the keywords virtual, override and final in a way compliant to the style guide. Reviewed By: yfeldblum Differential Revision: D5108973 fbshipit-source-id: 61c55aa372feebe3b3be12a2705a04879aae57a4
Codemod folly::make_unique to std::make_unique Summary: There are still some upstream references to `folly::make_unique` that need to be removed before it can be full killed, but this gets it most of the way there. Reviewed By: yfeldblum Differential Revision: D5024310 fbshipit-source-id: 6cfe8ea93662be18bb55588c8200dec72946e205
Treat OpenSSL as a non-portable include Summary: On Windows, the OpenSSL headers have to be included in a specific order relative to WinSock. Fixing the issues ad-hock is not a viable way to continue, so treat it as completely non-portable and require all includes of it in Folly to go through the portability header. Reviewed By: yfeldblum Differential Revision: D4856858 fbshipit-source-id: 56aca1fb0fe095f41a8af12488c6c2080344603d
Fix use after move in AsyncSSLSocket constructor. Summary: The new AsyncSocket is already constructed at this point so just use the event base from it. Reviewed By: djwatson Differential Revision: D4689395 fbshipit-source-id: aac898c1c6e6e0e0ffcb20b16bbf2b842cc31d54
Implementing a callback interface for folly::AsyncSocket allowing to supply an ancillary data buffer with msghdr structure to sendmsg() system call Summary: Implementing a callback interface for folly::AsyncSocket allowing to supply an ancillary data buffer with msghdr structure to sendmsg() system call. Reviewed By: afrind Differential Revision: D4422168 fbshipit-source-id: 29a23b05f704aff796d368f4ac9514c49b7ce578
Add getTotalConnectTimeout method Summary: AsyncSSLSocket can be connected using connect with total timeouts. This adds a method to get the total timeout that was set. Reviewed By: ngoyal, yfeldblum Differential Revision: D4656331 fbshipit-source-id: a55ad9f081449d358b8133e9598a2063f625a2e6
Split out SSL test server for reuse Summary: The TestSSLServer is useful to have on its own for reuse. This diff separates it out to make reuse possible. Reviewed By: yfeldblum Differential Revision: D4457976 fbshipit-source-id: 1fe6b71e930859ef04487e29047dcf603a79834b
Add pre received data API to AsyncSSLSocket. Summary: This allows something else (ie fizz) to read data from a socket, and then later decide to to accept an SSL connection with OpenSSL by inserting the data it read in front of future reads on the socket. Reviewed By: anirudhvr Differential Revision: D4325634 fbshipit-source-id: 05076d2d911fda681b9c4e5d9d3375559293ea35
2017 Summary: [Folly] 2017. Reviewed By: Orvid Differential Revision: D4378593 fbshipit-source-id: 4a448228bb1ddbe191b6e8562483867a399be846