diff options
Diffstat (limited to 'protocols/Weather/src/weather_http.cpp')
-rw-r--r-- | protocols/Weather/src/weather_http.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/protocols/Weather/src/weather_http.cpp b/protocols/Weather/src/weather_http.cpp index b0672282c1..5ef55cd7e8 100644 --- a/protocols/Weather/src/weather_http.cpp +++ b/protocols/Weather/src/weather_http.cpp @@ -27,16 +27,6 @@ from the web using netlib HNETLIBUSER hNetlibUser; -static int findHeader(const NETLIBHTTPREQUEST *nlhrReply, const char *hdr) -{ - for (int i = 0; i < nlhrReply->headersCount; i++) { - if (_stricmp(nlhrReply->headers[i].szName, hdr) == 0) { - return i; - } - } - return -1; -} - //============ DOWNLOAD NEW WEATHER ============ // // function to download webpage from the internet @@ -90,9 +80,9 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s result = 0; // allocate memory and save the retrieved data - int i = findHeader(nlhrReply, "Content-Type"); + auto *pszHdr = Netlib_GetHeader(nlhrReply, "Content-Type"); // look for Content-Type=utf-8 in header - if (i != -1 && strstr(_strlwr(nlhrReply->headers[i].szValue), "utf-8")) + if (pszHdr && strstr(pszHdr, "utf-8")) bIsUtf = true; else { char *end = nlhrReply->pData; |