From 66bef2fc196b1a5521d205938fd5d22c0c3a09ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 19 Mar 2024 15:21:23 +0800 Subject: [PATCH] Network: trim trailing white spaces --- src/detection/publicip/publicip.c | 1 + src/detection/weather/weather.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/detection/publicip/publicip.c b/src/detection/publicip/publicip.c index 4c1cdc42f..5475fdb4d 100644 --- a/src/detection/publicip/publicip.c +++ b/src/detection/publicip/publicip.c @@ -69,5 +69,6 @@ const char* ffDetectPublicIp(FFPublicIpOptions* options, FFPublicIpResult* resul ffStrbufDestroy(&result->ip); ffStrbufInitMove(&result->ip, &response); + ffStrbufTrimRightSpace(&result->ip); return NULL; } diff --git a/src/detection/weather/weather.c b/src/detection/weather/weather.c index 94bd6b5b6..544105a62 100644 --- a/src/detection/weather/weather.c +++ b/src/detection/weather/weather.c @@ -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";