diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-05 15:54:03 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-05 15:54:03 +0300 |
commit | 14c4e44a0a91e1ad701d4ae3c58185d25118e64e (patch) | |
tree | 50f36035466f355c74373e757bc00b6610ce6267 /plugins/HTTPServer/src | |
parent | 94667140aeb3886d22e4c1301423fe99aaf3fba4 (diff) |
Netlib:
- NETLIBHTTPHEADER & NETLIBHTTPREQUEST obsoleted;
- NETLIBHTTPREQUEST divided into MHttpRequest & MHttpResponse;
- MHttpHeaders now manager headers both for MHttpRequest & MHttpResponse;
Diffstat (limited to 'plugins/HTTPServer/src')
-rw-r--r-- | plugins/HTTPServer/src/GuiElements.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
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;
|