From a354fe84f319e2abbdfa4f144cca586cc2c18edd Mon Sep 17 00:00:00 2001 From: "ssu%netscape.com" Date: Wed, 23 May 2001 02:32:21 +0000 Subject: [PATCH] fixing bug 82279 - Win32 Installer crashes when using ftp proxy. r=sgehani,sr=mscott,a=chofmann. affects windows only git-svn-id: svn://10.0.0.236/trunk@95776 18797224-902f-48f8-a5cc-f745e15eee43 --- .../wizard/windows/setup/xpnetHook.cpp | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/mozilla/xpinstall/wizard/windows/setup/xpnetHook.cpp b/mozilla/xpinstall/wizard/windows/setup/xpnetHook.cpp index a8392074606..b70e48cbd73 100644 --- a/mozilla/xpinstall/wizard/windows/setup/xpnetHook.cpp +++ b/mozilla/xpinstall/wizard/windows/setup/xpnetHook.cpp @@ -520,12 +520,12 @@ int DownloadViaProxy(char *szUrl, char *szProxyServer, char *szProxyPort, char * { int rv; char proxyURL[kProxySrvrLen]; - char *host = NULL; - char *path = NULL; char *file = NULL; - int port; - rv = nsHTTPConn::ParseURL(kHTTP, szUrl, &host, &port, &path); + if((!szUrl) || (*szUrl == '\0')) + return nsHTTPConn::E_PARAM; + + rv = nsHTTPConn::OK; memset(proxyURL, 0, kProxySrvrLen); wsprintf(proxyURL, "http://%s:%s", szProxyServer, szProxyPort); @@ -549,8 +549,8 @@ int DownloadViaProxy(char *szUrl, char *szProxyServer, char *szProxyPort, char * if((rv = conn->Open()) != WIZ_OK) return(rv); - if(strrchr(path, '/') != (path + strlen(path))) - file = strrchr(path, '/') + 1; // set to leaf name + if(strrchr(szUrl, '/') != (szUrl + strlen(szUrl))) + file = strrchr(szUrl, '/') + 1; // set to leaf name rv = conn->Get(ProgressCB, file); // use leaf from URL conn->Close(); @@ -564,12 +564,12 @@ int DownloadViaProxy(char *szUrl, char *szProxyServer, char *szProxyPort, char * int DownloadViaHTTP(char *szUrl) { int rv; - char *host = NULL; - char *path = NULL; char *file = NULL; - int port; - rv = nsHTTPConn::ParseURL(kHTTP, szUrl, &host, &port, &path); + if((!szUrl) || (*szUrl == '\0')) + return nsHTTPConn::E_PARAM; + + rv = nsHTTPConn::OK; nsHTTPConn *conn = new nsHTTPConn(szUrl, ProcessWndMsgCB); if(conn == NULL) { @@ -584,8 +584,8 @@ int DownloadViaHTTP(char *szUrl) if((rv = conn->Open()) != WIZ_OK) return(rv); - if(strrchr(path, '/') != (path + strlen(path))) - file = strrchr(path, '/') + 1; // set to leaf name + if(strrchr(szUrl, '/') != (szUrl + strlen(szUrl))) + file = strrchr(szUrl, '/') + 1; // set to leaf name rv = conn->Get(ProgressCB, file); conn->Close(); @@ -602,6 +602,9 @@ int DownloadViaFTP(char *szUrl) int port = 21; int rv; + if((!szUrl) || (*szUrl == '\0')) + return nsFTPConn::E_PARAM; + rv = nsHTTPConn::ParseURL(kFTP, szUrl, &host, &port, &path); nsFTPConn *conn = new nsFTPConn(host, ProcessWndMsgCB);