diff options
author | George Hazan <ghazan@miranda.im> | 2019-07-25 14:04:43 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-07-25 14:04:43 +0300 |
commit | 8ea3ecaf3c4d554a2feb57ab551df73a701887d0 (patch) | |
tree | 01813cc971bbbd54026617d95a3e7a531364d57c /src | |
parent | fa54e993b8764b385898e3ed658b777a60d0da5f (diff) |
code cleaning
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/netlibhttp.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp index 575aff8623..4936841796 100644 --- a/src/mir_app/src/netlibhttp.cpp +++ b/src/mir_app/src/netlibhttp.cpp @@ -428,9 +428,6 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr if (!(nlhr->flags & NLHRF_MANUALHOST)) {
bool usingProxy = nlc->proxyType == PROXYTYPE_HTTP && !(nlhr->flags & NLHRF_SSL);
- mir_free(szHost);
- szHost = nullptr;
-
const char *ppath, *phost;
phost = strstr(pszUrl, "://");
if (phost == nullptr) phost = pszUrl;
@@ -439,7 +436,7 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr if (ppath == phost)
phost = nullptr;
- szHost = mir_strdup(phost);
+ replaceStr(szHost, phost);
if (ppath && phost)
szHost[ppath - phost] = 0;
@@ -453,12 +450,11 @@ MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr char *cln = strchr(tszHost, ':'); if (cln) *cln = 0;
if (inet_addr(tszHost) == INADDR_NONE) {
- DWORD ip = DnsLookup(nlu, tszHost);
- if (ip && szHost) {
+ in_addr ip;
+ if (ip.S_un.S_addr = DnsLookup(nlu, tszHost)) {
mir_free(szHost);
- szHost = (char*)mir_alloc(64);
if (cln) *cln = ':';
- mir_snprintf(szHost, 64, "%s%s", inet_ntoa(*(PIN_ADDR)&ip), cln ? cln : "");
+ szHost = CMStringA(FORMAT, "%s%s", inet_ntoa(ip), cln ? cln : "").Detach();
}
}
mir_free(tszHost);
|