summaryrefslogtreecommitdiff
path: root/protocols/Telegram/tdlib/td/tdnet
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-29 19:03:55 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-29 19:04:03 +0300
commitcebfc5c8facbf6ae335499f7f4b3dc57a60af999 (patch)
tree4c39e613c87f6164df1fe80601e611987aaaec84 /protocols/Telegram/tdlib/td/tdnet
parent189164bebda4bca9bb3d672500d844bfe7f26517 (diff)
TDLIB update up to the current state
Diffstat (limited to 'protocols/Telegram/tdlib/td/tdnet')
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/CMakeLists.txt6
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/DarwinHttp.mm16
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.cpp7
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.h3
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.cpp15
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.h4
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/HttpConnectionBase.cpp4
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/HttpProxy.cpp7
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.cpp24
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.h7
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/SslCtx.cpp4
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/SslStream.cpp12
-rw-r--r--protocols/Telegram/tdlib/td/tdnet/td/net/Wget.h8
13 files changed, 65 insertions, 52 deletions
diff --git a/protocols/Telegram/tdlib/td/tdnet/CMakeLists.txt b/protocols/Telegram/tdlib/td/tdnet/CMakeLists.txt
index e14f3500f9..0e35c97226 100644
--- a/protocols/Telegram/tdlib/td/tdnet/CMakeLists.txt
+++ b/protocols/Telegram/tdlib/td/tdnet/CMakeLists.txt
@@ -11,7 +11,6 @@ if (NOT OPENSSL_FOUND)
find_package(ZLIB REQUIRED)
endif()
-#SOURCE SETS
set(TDNET_SOURCE
td/net/GetHostByNameActor.cpp
td/net/HttpChunkedByteFlow.cpp
@@ -59,9 +58,6 @@ if (APPLE_WATCH)
set_source_files_properties(td/net/DarwinHttp.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
endif()
-#RULES
-#LIBRARIES
-
add_library(tdnet STATIC ${TDNET_SOURCE})
target_include_directories(tdnet PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_include_directories(tdnet SYSTEM PRIVATE $<BUILD_INTERFACE:${OPENSSL_INCLUDE_DIR}>)
@@ -84,7 +80,7 @@ if (APPLE_WATCH)
target_link_libraries(tdnet PRIVATE ${FOUNDATION_LIBRARY})
endif()
-install(TARGETS tdnet EXPORT TdTargets
+install(TARGETS tdnet EXPORT TdStaticTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/DarwinHttp.mm b/protocols/Telegram/tdlib/td/tdnet/td/net/DarwinHttp.mm
index 1b90e59add..7703f914e5 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/DarwinHttp.mm
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/DarwinHttp.mm
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -14,6 +14,18 @@
namespace td {
namespace {
+
+NSURLSession *getSession() {
+ static NSURLSession *urlSession = [] {
+ auto configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+ configuration.networkServiceType = NSURLNetworkServiceTypeResponsiveData;
+ configuration.timeoutIntervalForResource = 90;
+ configuration.waitsForConnectivity = true;
+ return [NSURLSession sessionWithConfiguration:configuration];
+ }();
+ return urlSession;
+}
+
NSString *to_ns_string(CSlice slice) {
return [NSString stringWithUTF8String:slice.c_str()];
}
@@ -43,7 +55,7 @@ auto http_post(CSlice url, Slice data) {
void http_send(NSURLRequest *request, Promise<BufferSlice> promise) {
__block auto callback = std::move(promise);
NSURLSessionDataTask *dataTask =
- [NSURLSession.sharedSession
+ [getSession()
dataTaskWithRequest:request
completionHandler:
^(NSData *data, NSURLResponse *response, NSError *error) {
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.cpp b/protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.cpp
index b2426c6e82..2cd1d93c3b 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.cpp
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.cpp
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -66,7 +66,7 @@ class GoogleDnsResolver final : public Actor {
return Status::Error("Failed to parse DNS result: Answer[0] is not an object");
}
auto &answer_0 = array[0].get_object();
- TRY_RESULT(ip_str, get_json_object_string_field(answer_0, "data", false));
+ TRY_RESULT(ip_str, answer_0.get_required_string_field("data"));
IPAddress ip;
TRY_STATUS(ip.init_host_port(ip_str, 0));
return ip;
@@ -82,7 +82,8 @@ class GoogleDnsResolver final : public Actor {
if (json_value.type() != JsonValue::Type::Object) {
return Status::Error("Failed to parse DNS result: not an object");
}
- TRY_RESULT(answer, get_json_object_field(json_value.get_object(), "Answer", JsonValue::Type::Array, false));
+ auto &object = json_value.get_object();
+ TRY_RESULT(answer, object.extract_required_field("Answer", JsonValue::Type::Array));
return get_ip_address(answer);
}
}
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.h b/protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.h
index 7cc61f248d..14a371192a 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.h
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/GetHostByNameActor.h
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -8,6 +8,7 @@
#include "td/actor/actor.h"
+#include "td/utils/common.h"
#include "td/utils/FlatHashMap.h"
#include "td/utils/logging.h"
#include "td/utils/port/IPAddress.h"
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.cpp b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.cpp
index f3fb3e43aa..38510a8751 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.cpp
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.cpp
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -19,7 +19,7 @@ bool HttpChunkedByteFlow::loop() {
do {
if (state_ == State::ReadChunkLength) {
bool ok = find_boundary(input_->clone(), "\r\n", len_);
- if (len_ > 10) {
+ if (len_ > 8) {
finish(Status::Error(PSLICE() << "Too long length in chunked "
<< input_->cut_head(len_).move_as_buffer_slice().as_slice()));
return false;
@@ -31,17 +31,13 @@ bool HttpChunkedByteFlow::loop() {
auto s_len = input_->cut_head(len_).move_as_buffer_slice();
input_->advance(2);
len_ = hex_to_integer<size_t>(s_len.as_slice());
- if (len_ > MAX_CHUNK_SIZE) {
- finish(Status::Error(PSLICE() << "Invalid chunk size " << tag("size", len_)));
- return false;
- }
save_len_ = len_;
state_ = State::ReadChunkContent;
}
auto size = input_->size();
auto ready = min(len_, size);
- auto need_size = min(MIN_UPDATE_SIZE, len_ + 2);
+ auto need_size = min(MIN_UPDATE_SIZE, len_) + 2;
if (size < need_size) {
set_need_size(need_size);
break;
@@ -51,14 +47,10 @@ bool HttpChunkedByteFlow::loop() {
return false;
}
total_size_ += ready;
- uncommitted_size_ += ready;
output_.append(input_->cut_head(ready));
result = true;
len_ -= ready;
- if (uncommitted_size_ >= MIN_UPDATE_SIZE) {
- uncommitted_size_ = 0;
- }
if (len_ == 0) {
if (input_->size() < 2) {
@@ -72,7 +64,6 @@ bool HttpChunkedByteFlow::loop() {
return false;
}
state_ = State::ReadChunkLength;
- len_ = 0;
}
} while (false);
if (!is_input_active_ && !result) {
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.h b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.h
index d8723dbeea..1f6a3e3545 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.h
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpChunkedByteFlow.h
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -17,7 +17,6 @@ class HttpChunkedByteFlow final : public ByteFlowBase {
bool loop() final;
private:
- static constexpr size_t MAX_CHUNK_SIZE = 15 << 20; // some reasonable limit
static constexpr size_t MAX_SIZE = std::numeric_limits<uint32>::max(); // some reasonable limit
static constexpr size_t MIN_UPDATE_SIZE = 1 << 14;
enum class State { ReadChunkLength, ReadChunkContent, OK };
@@ -25,7 +24,6 @@ class HttpChunkedByteFlow final : public ByteFlowBase {
size_t len_ = 0;
size_t save_len_ = 0;
size_t total_size_ = 0;
- size_t uncommitted_size_ = 0;
};
} // namespace td
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpConnectionBase.cpp b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpConnectionBase.cpp
index df8a7e132f..d310004e25 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpConnectionBase.cpp
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpConnectionBase.cpp
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -102,7 +102,7 @@ void HttpConnectionBase::loop() {
LOG(DEBUG) << "Can read from the connection";
auto r = fd_.flush_read();
if (r.is_error()) {
- if (!begins_with(r.error().message(), "SSL error {336134278")) { // if error is not yet outputed
+ if (!begins_with(r.error().message(), "SSL error {336134278")) { // if error is not yet outputted
LOG(INFO) << "Receive flush_read error: " << r.error();
}
on_error(Status::Error(r.error().public_message()));
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpProxy.cpp b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpProxy.cpp
index e76ca54196..b15dc0a476 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpProxy.cpp
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpProxy.cpp
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -25,7 +25,8 @@ void HttpProxy::send_connect() {
string proxy_authorization;
if (!username_.empty() || !password_.empty()) {
auto userinfo = PSTRING() << username_ << ':' << password_;
- proxy_authorization = PSTRING() << "Proxy-Authorization: basic " << base64_encode(userinfo) << "\r\n";
+ proxy_authorization = PSTRING() << "Proxy-Authorization: Basic " << base64_encode(userinfo) << "\r\n";
+ VLOG(proxy) << "Use credentials to connect to proxy: " << proxy_authorization;
}
fd_.output_buffer().append(PSLICE() << "CONNECT " << host << " HTTP/1.1\r\n"
<< "Host: " << host << "\r\n"
@@ -47,7 +48,7 @@ Status HttpProxy::wait_connect_response() {
char buf[1024];
size_t len = min(sizeof(buf), it.size());
it.advance(len, MutableSlice{buf, sizeof(buf)});
- VLOG(proxy) << "Failed to connect: " << format::escaped(Slice(buf, len));
+ VLOG(proxy) << "Failed to connect: " << format::escaped(begin) << format::escaped(Slice(buf, len));
return Status::Error(PSLICE() << "Failed to connect to " << ip_address_.get_ip_host() << ':'
<< ip_address_.get_port());
}
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.cpp b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.cpp
index 953495c1d2..6e14492299 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.cpp
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.cpp
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -30,7 +30,7 @@ void HttpReader::init(ChainBufferReader *input, size_t max_post_size, size_t max
input_ = input;
state_ = State::ReadHeaders;
headers_read_length_ = 0;
- content_length_ = 0;
+ content_length_ = -1;
query_ = nullptr;
max_post_size_ = max_post_size;
max_files_ = max_files;
@@ -43,6 +43,16 @@ Result<size_t> HttpReader::read_next(HttpQuery *query, bool can_be_slow) {
CHECK(query_ == nullptr);
query_ = query;
}
+
+ auto r_size = do_read_next(can_be_slow);
+ if (state_ != State::ReadHeaders && flow_sink_.is_ready() && r_size.is_ok() && r_size.ok() > 0) {
+ CHECK(flow_sink_.status().is_ok());
+ return Status::Error(400, "Bad Request: unexpected end of request content");
+ }
+ return r_size;
+}
+
+Result<size_t> HttpReader::do_read_next(bool can_be_slow) {
size_t need_size = input_->size() + 1;
while (true) {
if (state_ != State::ReadHeaders) {
@@ -65,14 +75,14 @@ Result<size_t> HttpReader::read_next(HttpQuery *query, bool can_be_slow) {
if (result.is_error() || result.ok() != 0) {
return result;
}
- if (transfer_encoding_.empty() && content_length_ == 0) {
+ if (transfer_encoding_.empty() && content_length_ <= 0) {
break;
}
flow_source_ = ByteFlowSource(input_);
ByteFlowInterface *source = &flow_source_;
if (transfer_encoding_.empty()) {
- content_length_flow_ = HttpContentLengthByteFlow(content_length_);
+ content_length_flow_ = HttpContentLengthByteFlow(narrow_cast<size_t>(content_length_));
*source >> content_length_flow_;
source = &content_length_flow_;
} else if (transfer_encoding_ == "chunked") {
@@ -103,7 +113,7 @@ Result<size_t> HttpReader::read_next(HttpQuery *query, bool can_be_slow) {
*source >> flow_sink_;
content_ = flow_sink_.get_output();
- if (content_length_ >= MAX_CONTENT_SIZE) {
+ if (content_length_ >= static_cast<int64>(MAX_CONTENT_SIZE)) {
return Status::Error(413, PSLICE() << "Request Entity Too Large: content length is " << content_length_);
}
@@ -563,7 +573,7 @@ void HttpReader::process_header(MutableSlice header_name, MutableSlice header_va
if (content_length > MAX_CONTENT_SIZE) {
content_length = MAX_CONTENT_SIZE;
}
- content_length_ = static_cast<size_t>(content_length);
+ content_length_ = static_cast<int64>(content_length);
} else if (header_name == "connection") {
to_lower_inplace(header_value);
if (header_value == "close") {
@@ -748,7 +758,7 @@ Status HttpReader::parse_head(MutableSlice head) {
parser.skip('\r');
parser.skip('\n');
- content_length_ = 0;
+ content_length_ = -1;
content_type_ = Slice("application/octet-stream");
content_type_lowercased_ = content_type_.str();
transfer_encoding_ = Slice();
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.h b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.h
index 4c360435d3..72635ca829 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.h
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/HttpReader.h
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -27,6 +27,7 @@ class HttpReader {
public:
void init(ChainBufferReader *input, size_t max_post_size = std::numeric_limits<size_t>::max(),
size_t max_files = 100);
+
Result<size_t> read_next(HttpQuery *query, bool can_be_slow = true) TD_WARN_UNUSED_RESULT; // TODO move query to init
HttpReader() = default;
@@ -49,7 +50,7 @@ class HttpReader {
enum class State { ReadHeaders, ReadContent, ReadContentToFile, ReadArgs, ReadMultipartFormData };
State state_ = State::ReadHeaders;
size_t headers_read_length_ = 0;
- size_t content_length_ = 0;
+ int64 content_length_ = -1;
ChainBufferReader *input_ = nullptr;
ByteFlowSource flow_source_;
HttpChunkedByteFlow chunked_flow_;
@@ -87,6 +88,8 @@ class HttpReader {
string temp_file_name_;
int64 file_size_ = 0;
+ Result<size_t> do_read_next(bool can_be_slow);
+
Result<size_t> split_header() TD_WARN_UNUSED_RESULT;
void process_header(MutableSlice header_name, MutableSlice header_value);
Result<bool> parse_multipart_form_data(bool can_be_slow) TD_WARN_UNUSED_RESULT;
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/SslCtx.cpp b/protocols/Telegram/tdlib/td/tdnet/td/net/SslCtx.cpp
index 913a0202d0..e12e201347 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/SslCtx.cpp
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/SslCtx.cpp
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -256,7 +256,7 @@ class SslCtxImpl {
auto r_ssl_ctx_ptr = do_create_ssl_ctx(cert_file, verify_peer);
auto elapsed_time = Time::now() - start_time;
if (elapsed_time >= 0.1) {
- LOG(ERROR) << "SSL context creation took " << elapsed_time << " seconds";
+ LOG(WARNING) << "SSL context creation took " << elapsed_time << " seconds";
}
if (r_ssl_ctx_ptr.is_error()) {
return r_ssl_ctx_ptr.move_as_error();
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/SslStream.cpp b/protocols/Telegram/tdlib/td/tdnet/td/net/SslStream.cpp
index 0fd8d2594c..a5f4d7ae0b 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/SslStream.cpp
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/SslStream.cpp
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -125,7 +125,7 @@ struct SslHandleDeleter {
SSL_free(ssl_handle);
auto elapsed_time = Time::now() - start_time;
if (elapsed_time >= 0.1) {
- LOG(ERROR) << "SSL_free took " << elapsed_time << " seconds";
+ LOG(WARNING) << "SSL_free took " << elapsed_time << " seconds";
}
}
};
@@ -207,8 +207,8 @@ class SslStreamImpl {
auto size = SSL_write(ssl_handle_.get(), slice.data(), static_cast<int>(slice.size()));
auto elapsed_time = Time::now() - start_time;
if (elapsed_time >= 0.1) {
- LOG(ERROR) << "SSL_write of size " << slice.size() << " took " << elapsed_time << " seconds and returned " << size
- << ' ' << SSL_get_error(ssl_handle_.get(), size);
+ LOG(WARNING) << "SSL_write of size " << slice.size() << " took " << elapsed_time << " seconds and returned "
+ << size << ' ' << SSL_get_error(ssl_handle_.get(), size);
}
if (size <= 0) {
return process_ssl_error(size);
@@ -222,8 +222,8 @@ class SslStreamImpl {
auto size = SSL_read(ssl_handle_.get(), slice.data(), static_cast<int>(slice.size()));
auto elapsed_time = Time::now() - start_time;
if (elapsed_time >= 0.1) {
- LOG(ERROR) << "SSL_read took " << elapsed_time << " seconds and returned " << size << ' '
- << SSL_get_error(ssl_handle_.get(), size);
+ LOG(WARNING) << "SSL_read took " << elapsed_time << " seconds and returned " << size << ' '
+ << SSL_get_error(ssl_handle_.get(), size);
}
if (size <= 0) {
return process_ssl_error(size);
diff --git a/protocols/Telegram/tdlib/td/tdnet/td/net/Wget.h b/protocols/Telegram/tdlib/td/tdnet/td/net/Wget.h
index 2c78a522e7..bc017a1d02 100644
--- a/protocols/Telegram/tdlib/td/tdnet/td/net/Wget.h
+++ b/protocols/Telegram/tdlib/td/tdnet/td/net/Wget.h
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -22,9 +22,9 @@ namespace td {
class Wget final : public HttpOutboundConnection::Callback {
public:
- explicit Wget(Promise<unique_ptr<HttpQuery>> promise, string url, std::vector<std::pair<string, string>> headers = {},
- int32 timeout_in = 10, int32 ttl = 3, bool prefer_ipv6 = false,
- SslCtx::VerifyPeer verify_peer = SslCtx::VerifyPeer::On, string content = {}, string content_type = {});
+ Wget(Promise<unique_ptr<HttpQuery>> promise, string url, std::vector<std::pair<string, string>> headers = {},
+ int32 timeout_in = 10, int32 ttl = 3, bool prefer_ipv6 = false,
+ SslCtx::VerifyPeer verify_peer = SslCtx::VerifyPeer::On, string content = {}, string content_type = {});
private:
Status try_init();