Net fixes

This commit is contained in:
luboslenco
2025-09-13 13:54:11 +02:00
parent bcedb87ded
commit 034c6389f6
2 changed files with 8 additions and 1 deletions
+7 -1
View File
@@ -30,7 +30,13 @@ void iron_https_request(const char *url_base, const char *url_path, const char *
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
dispatch_async(dispatch_get_main_queue(), ^{
callback((const char *)[data bytes], callbackdata);
char *b = (char *)[data bytes];
int len = [data length];
char *result = malloc(len + 1);
memcpy(result, b, len);
result[len] = 0;
callback(result, callbackdata);
free(result);
});
}
];
@@ -23,6 +23,7 @@ class AndroidHttpRequest {
while ((i = in.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, i);
}
buffer.write(0);
buffer.flush();
byte[] result = buffer.toByteArray();