Skip to content

Commit 90b9b5f

Browse files
[SDK 894] added HTTP timeout (#72)
* HTTP timeout set * change log added * Update CHANGELOG.md Co-authored-by: ArtursKadikis <[email protected]>
1 parent e2016ce commit 90b9b5f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
22.02.0
2+
* Added 10-second time-outs for all windows HTTP transactions.
3+
14
21.11.3
25
* Added functionality to set custom SHA256.
36

src/countly.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,13 @@ Countly::HTTPResponse Countly::sendHTTP(std::string path, std::string data) {
871871

872872
hSession = WinHttpOpen(NULL, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
873873
if (hSession) {
874+
// Set way Shorter timeouts:
875+
WinHttpSetTimeouts(hSession,
876+
10000, // nResolveTimeout: 10sec (default 'infinite').
877+
10000, // nConnectTimeout: 10sec (default 60sec).
878+
10000, // nSendTimeout: 10sec (default 30sec).
879+
10000); // nReceiveTimeout: 10sec (default 30sec).
880+
874881
size_t scheme_offset = use_https ? (sizeof("https://") - 1) : (sizeof("http://") - 1);
875882
size_t buffer_size = MultiByteToWideChar(CP_ACP, 0, host.c_str() + scheme_offset, -1, nullptr, 0);
876883
wchar_t *wide_hostname = new wchar_t[buffer_size];

0 commit comments

Comments
 (0)