summaryrefslogtreecommitdiff
path: root/src/tool/client.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool/client.cc')
-rw-r--r--src/tool/client.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/tool/client.cc b/src/tool/client.cc
index d3a3115e..a5254b21 100644
--- a/src/tool/client.cc
+++ b/src/tool/client.cc
@@ -135,6 +135,14 @@ static const struct argument kArguments[] = {
"An HTTP proxy server to tunnel the TCP connection through",
},
{
+ "-renegotiate-freely", kBooleanArgument,
+ "Allow renegotiations from the peer.",
+ },
+ {
+ "-debug", kBooleanArgument,
+ "Print debug information about the handshake",
+ },
+ {
"", kOptionalArgument, "",
},
};
@@ -262,6 +270,10 @@ static bool DoConnection(SSL_CTX *ctx,
SSL_set_session(ssl.get(), session.get());
}
+ if (args_map.count("-renegotiate-freely") != 0) {
+ SSL_set_renegotiate_mode(ssl.get(), ssl_renegotiate_freely);
+ }
+
if (resume_session) {
SSL_set_session(ssl.get(), resume_session.get());
}
@@ -317,6 +329,20 @@ static bool GetTLS13Variant(tls13_variant_t *out, const std::string &in) {
return false;
}
+static void InfoCallback(const SSL *ssl, int type, int value) {
+ switch (type) {
+ case SSL_CB_HANDSHAKE_START:
+ fprintf(stderr, "Handshake started.\n");
+ break;
+ case SSL_CB_HANDSHAKE_DONE:
+ fprintf(stderr, "Handshake done.\n");
+ break;
+ case SSL_CB_CONNECT_LOOP:
+ fprintf(stderr, "Handshake progress: %s\n", SSL_state_string_long(ssl));
+ break;
+ }
+}
+
bool Client(const std::vector<std::string> &args) {
if (!InitSocketLibrary()) {
return false;
@@ -329,7 +355,7 @@ bool Client(const std::vector<std::string> &args) {
return false;
}
- bssl::UniquePtr<SSL_CTX> ctx(SSL_CTX_new(SSLv23_client_method()));
+ bssl::UniquePtr<SSL_CTX> ctx(SSL_CTX_new(TLS_method()));
const char *keylog_file = getenv("SSLKEYLOGFILE");
if (keylog_file) {
@@ -497,6 +523,10 @@ bool Client(const std::vector<std::string> &args) {
SSL_CTX_set_ed25519_enabled(ctx.get(), 1);
}
+ if (args_map.count("-debug") != 0) {
+ SSL_CTX_set_info_callback(ctx.get(), InfoCallback);
+ }
+
if (args_map.count("-test-resumption") != 0) {
if (args_map.count("-session-in") != 0) {
fprintf(stderr,