From c9889d1a2025f5fee92b8eca54f96b1c28053bfe Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 15 Jul 2020 16:38:04 +0300 Subject: [PATCH] Fix TLS handshake. GitOrigin-RevId: 7542732a79c9fed971332203a620f32ce6d8f878 --- benchmark/check_tls.cpp | 2 +- td/mtproto/TlsInit.cpp | 2 +- test/mtproto.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/benchmark/check_tls.cpp b/benchmark/check_tls.cpp index a2dd73255..a60d64f10 100644 --- a/benchmark/check_tls.cpp +++ b/benchmark/check_tls.cpp @@ -129,7 +129,7 @@ td::Result test_tls(const td::string &url) { add_grease(4); add_string( "\x00\x1d\x00\x17\x00\x18\x00\x0b\x00\x02\x01\x00\x00\x23\x00\x00\x00\x10\x00\x0e\x00\x0c\x02\x68\x32\x08\x68" - "\x74\x74\x70\x2f\x31\x2e\x31\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\x0d\x00\x14\x00\x12\x04\x03\x08\x04\x04" + "\x74\x74\x70\x2f\x31\x2e\x31\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\x0d\x00\x12\x00\x10\x04\x03\x08\x04\x04" "\x01\x05\x03\x08\x05\x05\x01\x08\x06\x06\x01\x00\x12\x00\x00\x00\x33\x00\x2b\x00\x29"); add_grease(4); add_string("\x00\x01\x00\x00\x1d\x00\x20"); diff --git a/td/mtproto/TlsInit.cpp b/td/mtproto/TlsInit.cpp index aa3e6e672..4efd153d5 100644 --- a/td/mtproto/TlsInit.cpp +++ b/td/mtproto/TlsInit.cpp @@ -143,7 +143,7 @@ class TlsHello { Op::grease(4), Op::string( "\x00\x1d\x00\x17\x00\x18\x00\x0b\x00\x02\x01\x00\x00\x23\x00\x00\x00\x10\x00\x0e\x00\x0c\x02\x68\x32\x08" - "\x68\x74\x74\x70\x2f\x31\x2e\x31\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\x0d\x00\x14\x00\x12\x04\x03\x08" + "\x68\x74\x74\x70\x2f\x31\x2e\x31\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\x0d\x00\x12\x00\x10\x04\x03\x08" "\x04\x04\x01\x05\x03\x08\x05\x05\x01\x08\x06\x06\x01\x00\x12\x00\x00\x00\x33\x00\x2b\x00\x29"), Op::grease(4), Op::string("\x00\x01\x00\x00\x1d\x00\x20"), diff --git a/test/mtproto.cpp b/test/mtproto.cpp index a0a894985..c6b11de20 100644 --- a/test/mtproto.cpp +++ b/test/mtproto.cpp @@ -670,8 +670,10 @@ TEST(Mtproto, TlsTransport) { class Callback : public TransparentProxy::Callback { public: void set_result(Result result) override { - if (!result.is_error() || result.error().message() != "Response hash mismatch") { - LOG(ERROR) << "Receive unexpected result"; + if (result.is_ok()) { + LOG(ERROR) << "Unexpectedly succeeded to connect to MTProto proxy"; + } else if (result.error().message() != "Response hash mismatch") { + LOG(ERROR) << "Receive unexpected result " << result.error(); } Scheduler::instance()->finish(); }