Skip to content

Commit ac866b0

Browse files
Merge branch 'staging' into sdk-655
2 parents 9286b41 + 19c2e40 commit ac866b0

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
21.11.1
2+
* !! Major breaking change !! Fixed a bug that triggered when providing segmentation to the "RecordEvent" call. Previously, by mistake, every segmentation value was parsed as a JSON and threw an exception when it wasn't a valid JSON string. Now this will not be the case and every String value can be provided. This is marked as a "major breaking change" in case some integrations were adding workarounds to this issue.
23
* ! Minor breaking change ! Default automatic session update duration changed to 60 seconds.
34
* Added a call to change the automatic session update duration.
45
* Fixed a bug where session duration was reported wrong.
56
* Fixed a bug that was a typo ('COUNTLY_CUSTOM_HTTP' instead of 'COUNTLY_USE_CUSTOM_HTTP') in the cmake file that cause the SDK to be misconfigured.
7+
* Fixed a bug that caused POST requests to fail on Windows.
68

79
21.11.0
810
* Fixed session duration issue.

include/countly.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class Countly {
182182
Event event(key, count);
183183

184184
for (auto key_value: segmentation) {
185-
event.addSegmentation(key_value.first, json::parse(key_value.second));
185+
event.addSegmentation(key_value.first, key_value.second);
186186
}
187187

188188
addEvent(event);
@@ -192,7 +192,7 @@ class Countly {
192192
Event event(key, count, sum);
193193

194194
for (auto key_value: segmentation) {
195-
event.addSegmentation(key_value.first, json::parse(key_value.second));
195+
event.addSegmentation(key_value.first, key_value.second);
196196
}
197197

198198
addEvent(event);
@@ -202,7 +202,7 @@ class Countly {
202202
Event event(key, count, sum, duration);
203203

204204
for (auto key_value: segmentation) {
205-
event.addSegmentation(key_value.first, json::parse(key_value.second));
205+
event.addSegmentation(key_value.first, key_value.second);
206206
}
207207

208208
addEvent(event);

src/countly.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ void Countly::stop() {
242242
log(Countly::LogLevel::WARNING, "Could not join thread");
243243
}
244244
delete thread;
245+
thread = nullptr;
245246
}
246247
if (began_session) {
247248
endSession();
@@ -655,20 +656,21 @@ log(Countly::LogLevel::DEBUG, "[Countly][sendHTTP] data: "+ data);
655656
data += "checksum256=";
656657
data += checksum_stream.str();
657658
}
659+
660+
Countly::HTTPResponse response;
661+
response.success = false;
662+
658663
#ifdef COUNTLY_USE_CUSTOM_HTTP
659664
if (http_client_function == nullptr) {
660665
log(Countly::LogLevel::FATAL, "Missing HTTP client function");
661-
return false;
666+
return response;
662667
}
663668

664669
return http_client_function(use_post, path, data);
665670
#else
666671
if (http_client_function != nullptr) {
667672
return http_client_function(use_post, path, data);
668673
}
669-
670-
Countly::HTTPResponse response;
671-
response.success = false;
672674
#ifdef _WIN32
673675
HINTERNET hSession;
674676
HINTERNET hConnect;
@@ -701,7 +703,8 @@ log(Countly::LogLevel::DEBUG, "[Countly][sendHTTP] data: "+ data);
701703
}
702704

703705
if (hRequest) {
704-
bool ok = WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, use_post ? (LPVOID)data.data() : WINHTTP_NO_REQUEST_DATA, use_post ? data.size() : 0, 0, 0) != 0;
706+
LPCWSTR headers = use_post ? L"content-type:application/x-www-form-urlencoded" : WINHTTP_NO_ADDITIONAL_HEADERS;
707+
bool ok = WinHttpSendRequest(hRequest, headers, 0, use_post ? (LPVOID)data.data() : WINHTTP_NO_REQUEST_DATA, use_post ? data.size() : 0, use_post ? data.size() : 0, 0) != 0;
705708
if (ok) {
706709
ok = WinHttpReceiveResponse(hRequest, NULL);
707710
if (ok) {

0 commit comments

Comments
 (0)