@@ -334,7 +334,7 @@ int extract_query_param(const char *query, const char *key, char *output, size_t
334334 return -3 ; // Key not found
335335}
336336
337- bool network_compute_endpoints (sqlite3_context * context , network_data * data , const char * connection_string ) {
337+ bool network_compute_endpoints (sqlite3_context * context , network_data * data , const char * conn_string ) {
338338 // compute endpoints
339339 bool result = false;
340340
@@ -348,12 +348,16 @@ bool network_compute_endpoints (sqlite3_context *context, network_data *data, co
348348 char * check_endpoint = NULL ;
349349 char * upload_endpoint = NULL ;
350350
351+ char * conn_string_https = NULL ;
352+
351353 CURLUcode rc = CURLUE_OUT_OF_MEMORY ;
352354 CURLU * url = curl_url ();
353355 if (!url ) goto finalize ;
354356
357+ conn_string_https = cloudsync_string_replace_prefix (conn_string , "sqlitecloud://" , "https://" );
358+
355359 // set URL: https://UUID.g5.sqlite.cloud:443/chinook.sqlite?apikey=hWDanFolRT9WDK0p54lufNrIyfgLZgtMw6tb6fbPmpo
356- rc = curl_url_set (url , CURLUPART_URL , connection_string , 0 );
360+ rc = curl_url_set (url , CURLUPART_URL , conn_string_https , 0 );
357361 if (rc != CURLE_OK ) goto finalize ;
358362
359363 // https (MANDATORY)
@@ -421,6 +425,7 @@ bool network_compute_endpoints (sqlite3_context *context, network_data *data, co
421425 if (database ) curl_free (database );
422426 if (query ) curl_free (query );
423427 if (url ) curl_url_cleanup (url );
428+ if (conn_string_https && conn_string_https != conn_string ) cloudsync_memory_free (conn_string_https );
424429
425430 return result ;
426431}
0 commit comments