diff options
| author | Arseny Smirnov <arseny30@gmail.com> | 2018-08-15 15:41:42 +0300 |
|---|---|---|
| committer | Arseny Smirnov <arseny30@gmail.com> | 2018-08-15 15:41:42 +0300 |
| commit | ab2b1897224415f407649b2908fef46f97b35c83 (patch) | |
| tree | 16897c84a4b6592fe9f46650ad48ac9b66a2d8aa /tdnet/td/net/Wget.cpp | |
| parent | 7fc96ddff5c0e85273b3d961608a891a9fb55d19 (diff) | |
Ssl refactoring
GitOrigin-RevId: f5916787608227b6914c10520dfe7a7039522ef9
Diffstat (limited to 'tdnet/td/net/Wget.cpp')
| -rw-r--r-- | tdnet/td/net/Wget.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tdnet/td/net/Wget.cpp b/tdnet/td/net/Wget.cpp index d4ea27de8..58e39ea57 100644 --- a/tdnet/td/net/Wget.cpp +++ b/tdnet/td/net/Wget.cpp @@ -8,7 +8,7 @@ #include "td/net/HttpHeaderCreator.h" #include "td/net/HttpOutboundConnection.h" -#include "td/net/SslFd.h" +#include "td/net/SslStream.h" #include "td/utils/buffer.h" #include "td/utils/HttpUrl.h" @@ -23,7 +23,7 @@ namespace td { Wget::Wget(Promise<HttpQueryPtr> promise, string url, std::vector<std::pair<string, string>> headers, int32 timeout_in, - int32 ttl, bool prefer_ipv6, SslFd::VerifyPeer verify_peer) + int32 ttl, bool prefer_ipv6, SslStream::VerifyPeer verify_peer) : promise_(std::move(promise)) , input_url_(std::move(url)) , headers_(std::move(headers)) @@ -66,14 +66,15 @@ Status Wget::try_init() { TRY_RESULT(fd, SocketFd::open(addr)); if (url.protocol_ == HttpUrl::Protocol::HTTP) { - connection_ = - create_actor<HttpOutboundConnection>("Connect", std::move(fd), std::numeric_limits<std::size_t>::max(), 0, 0, - ActorOwn<HttpOutboundConnection::Callback>(actor_id(this))); + connection_ = create_actor<HttpOutboundConnection>("Connect", std::move(fd), SslStream{}, + std::numeric_limits<std::size_t>::max(), 0, 0, + ActorOwn<HttpOutboundConnection::Callback>(actor_id(this))); } else { - TRY_RESULT(ssl_fd, SslFd::init(std::move(fd), url.host_, CSlice() /* certificate */, verify_peer_)); - connection_ = - create_actor<HttpOutboundConnection>("Connect", std::move(ssl_fd), std::numeric_limits<std::size_t>::max(), 0, - 0, ActorOwn<HttpOutboundConnection::Callback>(actor_id(this))); + LOG(ERROR) << "HTTPS"; + TRY_RESULT(ssl_stream, SslStream::create(url.host_, CSlice() /* certificate */, verify_peer_)); + connection_ = create_actor<HttpOutboundConnection>("Connect", std::move(fd), std::move(ssl_stream), + std::numeric_limits<std::size_t>::max(), 0, 0, + ActorOwn<HttpOutboundConnection::Callback>(actor_id(this))); } send_closure(connection_, &HttpOutboundConnection::write_next, BufferSlice(header)); |
