From 14c4e44a0a91e1ad701d4ae3c58185d25118e64e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Jan 2024 15:54:03 +0300 Subject: Netlib: - NETLIBHTTPHEADER & NETLIBHTTPREQUEST obsoleted; - NETLIBHTTPREQUEST divided into MHttpRequest & MHttpResponse; - MHttpHeaders now manager headers both for MHttpRequest & MHttpResponse; --- plugins/HTTPServer/src/GuiElements.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'plugins/HTTPServer/src') diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 329258e1b9..a3f02f86bb 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -141,11 +141,9 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) { HCURSOR hPrevCursor = ::SetCursor(::LoadCursor(nullptr, IDC_WAIT)); - NETLIBHTTPREQUEST nlhr; - memset(&nlhr, 0, sizeof(nlhr)); - nlhr.requestType = REQUEST_GET; + MHttpRequest nlhr; nlhr.flags = NLHRF_DUMPASTEXT; - nlhr.szUrl = (char*)szURL; + nlhr.m_szUrl = szURL; IN_ADDR externIP; externIP.s_addr = 0; @@ -153,16 +151,15 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) NLHR_PTR nlreply(Netlib_HttpTransaction(hNetlibUser, &nlhr)); if (nlreply) { if (nlreply->resultCode >= 200 && nlreply->resultCode < 300) { - nlreply->pData[nlreply->dataLength] = 0;// make sure its null terminated - char * pszIp = strstr(nlreply->pData, szPattern); + char *pszIp = strstr(nlreply->body.GetBuffer(), szPattern); if (pszIp == nullptr) - pszIp = nlreply->pData; + pszIp = nlreply->body.GetBuffer(); else pszIp += mir_strlen(szPattern); while ((*pszIp < '0' || *pszIp > '9') && *pszIp) pszIp++; - char * pszEnd = pszIp; + char *pszEnd = pszIp; while ((*pszEnd >= '0' && *pszEnd <= '9') || *pszEnd == '.') pszEnd++; *pszEnd = NULL; -- cgit v1.2.3