Network: trim trailing white spaces

This commit is contained in:
李通洲
2024-03-19 15:21:23 +08:00
parent 7c5eb021ee
commit 66bef2fc19
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -69,5 +69,6 @@ const char* ffDetectPublicIp(FFPublicIpOptions* options, FFPublicIpResult* resul
ffStrbufDestroy(&result->ip);
ffStrbufInitMove(&result->ip, &response);
ffStrbufTrimRightSpace(&result->ip);
return NULL;
}
+5 -1
View File
@@ -29,7 +29,11 @@ const char* ffDetectWeather(FFWeatherOptions* options, FFstrbuf* result)
ffStrbufEnsureFree(result, 4095);
bool success = ffNetworkingRecvHttpResponse(&state, result, options->timeout);
if (success) ffStrbufSubstrAfterFirstS(result, "\r\n\r\n");
if (success)
{
ffStrbufSubstrAfterFirstS(result, "\r\n\r\n");
ffStrbufTrimRightSpace(result);
}
if(!success || result->length == 0)
return "Failed to receive the server response";