diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index c89855394d73..c1fd520d0ee3 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2567,6 +2567,14 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI, const PRUnichar *aUR // Port blocked for security reasons error.Assign(NS_LITERAL_STRING("deniedPortAccess")); break; + case NS_ERROR_UNKNOWN_PROXY_HOST: + // Proxy hostname could not be resolved. + error.Assign(NS_LITERAL_STRING("proxyResolveFailure")); + break; + case NS_ERROR_PROXY_CONNECTION_REFUSED: + // Proxy connection was refused. + error.Assign(NS_LITERAL_STRING("proxyConnectFailure")); + break; } } diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index e70a97a9fbac..2ae4ff99c809 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -931,7 +931,9 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress, // Errors to be shown only on top-level frames if ((aStatus == NS_ERROR_UNKNOWN_HOST || - aStatus == NS_ERROR_CONNECTION_REFUSED) && + aStatus == NS_ERROR_CONNECTION_REFUSED || + aStatus == NS_ERROR_UNKNOWN_PROXY_HOST || + aStatus == NS_ERROR_PROXY_CONNECTION_REFUSED) && (isTopFrame || mUseErrorPages)) { DisplayLoadError(aStatus, url, nsnull); } diff --git a/docshell/resources/locale/en-US/appstrings.properties b/docshell/resources/locale/en-US/appstrings.properties index 4f96e83f8346..b2fdd684fc19 100644 --- a/docshell/resources/locale/en-US/appstrings.properties +++ b/docshell/resources/locale/en-US/appstrings.properties @@ -32,3 +32,5 @@ netReset=The document contains no data. netOffline=This document cannot be displayed while offline. isprinting=The document cannot change while Printing or in Print Preview. deniedPortAccess=Access to the port number given has been disabled for security reasons. +proxyResolveFailure=The proxy server you have configured could not be found. Please check your proxy settings and try again. +proxyConnectFailure=The connection was refused when attempting to contact the proxy server you have configured. Please check your proxy settings and try again. diff --git a/embedding/browser/photon/src/EmbedProgress.cpp b/embedding/browser/photon/src/EmbedProgress.cpp index 18acfaba4b65..b696572b9759 100644 --- a/embedding/browser/photon/src/EmbedProgress.cpp +++ b/embedding/browser/photon/src/EmbedProgress.cpp @@ -101,6 +101,7 @@ EmbedProgress::OnStateChange(nsIWebProgress *aWebProgress, switch( aStatus ) { case NS_ERROR_UNKNOWN_HOST: + case NS_ERROR_UNKNOWN_PROXY_HOST: cbw.reason = -12; break; case NS_ERROR_NET_TIMEOUT: @@ -113,6 +114,7 @@ EmbedProgress::OnStateChange(nsIWebProgress *aWebProgress, cbw.reason = -404; break; case NS_ERROR_CONNECTION_REFUSED: + case NS_ERROR_PROXY_CONNECTION_REFUSED: cbw.reason = -13; break; diff --git a/mailnews/base/util/nsMsgProtocol.cpp b/mailnews/base/util/nsMsgProtocol.cpp index 39507bce3575..7c17fb9834e5 100644 --- a/mailnews/base/util/nsMsgProtocol.cpp +++ b/mailnews/base/util/nsMsgProtocol.cpp @@ -361,9 +361,11 @@ NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIRequest *request, nsISupports *ctx switch (aStatus) { case NS_ERROR_UNKNOWN_HOST: + case NS_ERROR_UNKNOWN_PROXY_HOST: errorID = UNKNOWN_HOST_ERROR; break; case NS_ERROR_CONNECTION_REFUSED: + case NS_ERROR_PROXY_CONNECTION_REFUSED: errorID = CONNECTION_REFUSED_ERROR; break; case NS_ERROR_NET_TIMEOUT: diff --git a/mailnews/compose/src/nsMsgSend.cpp b/mailnews/compose/src/nsMsgSend.cpp index 0660ea9168a6..86075f366ec1 100644 --- a/mailnews/compose/src/nsMsgSend.cpp +++ b/mailnews/compose/src/nsMsgSend.cpp @@ -100,6 +100,7 @@ #include "nsMsgSendReport.h" #include "nsMsgSimulateError.h" #include "nsNetCID.h" +#include "nsNetError.h" #include "nsMsgUtils.h" #include "nsIRDFService.h" #include "nsIMsgMdnGenerator.h" @@ -3166,6 +3167,7 @@ SendDeliveryCallback(nsIURI *aUrl, nsresult aExitCode, nsMsgDeliveryType deliver switch (aExitCode) { case NS_ERROR_UNKNOWN_HOST: + case NS_ERROR_UNKNOWN_PROXY_HOST: aExitCode = NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER; break; default: diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index 56ad8d08f57b..46314ae7583b 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -1475,9 +1475,11 @@ NS_IMETHODIMP nsImapProtocol::OnStopRequest(nsIRequest *request, nsISupports *ct switch (aStatus) { case NS_ERROR_UNKNOWN_HOST: + case NS_ERROR_UNKNOWN_PROXY_HOST: AlertUserEventUsingId(IMAP_UNKNOWN_HOST_ERROR); break; case NS_ERROR_CONNECTION_REFUSED: + case NS_ERROR_PROXY_CONNECTION_REFUSED: AlertUserEventUsingId(IMAP_CONNECTION_REFUSED_ERROR); break; case NS_ERROR_NET_TIMEOUT: diff --git a/netwerk/base/public/MANIFEST b/netwerk/base/public/MANIFEST index 95c27ea81425..204bceb8c5d2 100644 --- a/netwerk/base/public/MANIFEST +++ b/netwerk/base/public/MANIFEST @@ -3,6 +3,7 @@ # netCore.h +nsNetError.h nsNetUtil.h nsUnixColorPrintf.h nsReadLine.h diff --git a/netwerk/base/public/Makefile.in b/netwerk/base/public/Makefile.in index 95b49559a653..7e86353d9811 100644 --- a/netwerk/base/public/Makefile.in +++ b/netwerk/base/public/Makefile.in @@ -94,6 +94,7 @@ XPIDLSRCS = \ EXPORTS = \ netCore.h \ + nsNetError.h \ nsNetUtil.h \ nsUnixColorPrintf.h \ nsReadLine.h \ diff --git a/netwerk/base/public/netCore.h b/netwerk/base/public/netCore.h index b7783d63a1ca..925fb2993b3c 100644 --- a/netwerk/base/public/netCore.h +++ b/netwerk/base/public/netCore.h @@ -38,74 +38,7 @@ #ifndef __netCore_h__ #define __netCore_h__ -#include "nsError.h" - - /* networking error codes */ - -// NET RANGE: 1 -20 -// FTP RANGE: 21-30 -// HTTP RANGE: 31-40 -// DNS RANGE: 41-50 -// SOCKET RANGE 51-60 -// CACHE RANGE: 61-70 -// NET RANGE 2: 71-80 - -// XXX Why can't we put all Netwerk error codes in one file to help avoid collisions? - -// Generic status codes for OnStopRequest: -#define NS_BINDING_SUCCEEDED NS_OK -#define NS_BINDING_FAILED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1) -#define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2) - -// The binding has been moved to another request in the same load group: -#define NS_BINDING_REDIRECTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 3) - -// The binding has been moved to another request in a different load group: -#define NS_BINDING_RETARGETED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 4) - -#define NS_ERROR_MALFORMED_URI \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 10) - -#define NS_ERROR_ALREADY_CONNECTED \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 11) - -#define NS_ERROR_NOT_CONNECTED \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 12) - -/* see nsISocketTransportService.idl for other errors */ - -#define NS_ERROR_IN_PROGRESS \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 15) - -#define NS_ERROR_OFFLINE \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 16) - -// Unknown Protocol Error -#define NS_ERROR_UNKNOWN_PROTOCOL \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18) - -// There is no content available (when nsIChannel::asyncOpen is called) -#define NS_ERROR_NO_CONTENT \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 17) - -#define NS_ERROR_PORT_ACCESS_NOT_ALLOWED \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 19) - -/* 20 - 24 defined in ftpCore.h */ - -#define NS_ERROR_NOT_RESUMABLE \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 25) - -#define NS_ERROR_REDIRECT_LOOP \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 31) - -#define NS_ERROR_NET_INTERRUPT \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 71) - -/** - * nsresult passed through onStopRequest if the document could not be fetched from the cache. - */ -#define NS_ERROR_DOCUMENT_NOT_CACHED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 70) +#include "nsNetError.h" // Where most necko status messages come from: #define NECKO_MSGS_URL "chrome://necko/locale/necko.properties" diff --git a/netwerk/base/public/nsISocketTransportService.idl b/netwerk/base/public/nsISocketTransportService.idl index e48b1793aa53..3e57ffa2316d 100644 --- a/netwerk/base/public/nsISocketTransportService.idl +++ b/netwerk/base/public/nsISocketTransportService.idl @@ -119,14 +119,7 @@ interface nsISocketTransportService : nsISupports {0x92, 0xb6, 0x00, 0x10, 0x5a, 0x1b, 0x0d, 0x64} \ } -// if a socket connection attempt fails (eg. no server listening at specified host:port) -#define NS_ERROR_CONNECTION_REFUSED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 13) - -// if a socket connection was lost due to a timeout error (eg. PR_Poll times out) -#define NS_ERROR_NET_TIMEOUT NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 14) - -// if a socket connection was lost due to a network reset (eg. PR_Poll sets PR_POLL_ERR) -#define NS_ERROR_NET_RESET NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 20) +#include "nsNetError.h" /** * Status nsresult codes: used with nsIProgressEventSink::OnStatus diff --git a/netwerk/base/public/nsNetError.h b/netwerk/base/public/nsNetError.h new file mode 100644 index 000000000000..c33f9bf1e07e --- /dev/null +++ b/netwerk/base/public/nsNetError.h @@ -0,0 +1,290 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Darin Fisher (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsNetError_h__ +#define nsNetError_h__ + +#include "nsError.h" + + +/* NETWORKING ERROR CODES */ + + +/****************************************************************************** + * General async request error codes: + * + * These error codes are commonly passed through callback methods to indicate + * the status of some requested async request. + * + * For example, see nsIRequestObserver::onStopRequest. + */ + +/** + * The async request completed successfully. + */ +#define NS_BINDING_SUCCEEDED \ + NS_OK + +/** + * The async request failed for some unknown reason. + */ +#define NS_BINDING_FAILED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1) + +/** + * The async request failed because it was aborted by some user action. + */ +#define NS_BINDING_ABORTED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2) + +/** + * The async request has been "redirected" to a different async request. + * (e.g., an HTTP redirect occured). + * + * This error code is used with load groups to notify the load group observer + * when a request in the load group is redirected to another request. + */ +#define NS_BINDING_REDIRECTED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 3) + +/** + * The async request has been "retargeted" to a different "handler." + * + * This error code is used with load groups to notify the load group observer + * when a request in the load group is removed from the load group and added + * to a different load group. + */ +#define NS_BINDING_RETARGETED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 4) + + +/****************************************************************************** + * Miscellaneous error codes: + * + * These errors are not typically passed via onStopRequest. + */ + +/** + * The URI is malformed. + */ +#define NS_ERROR_MALFORMED_URI \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 10) + +/** + * The URI scheme corresponds to an unknown protocol handler. + */ +#define NS_ERROR_UNKNOWN_PROTOCOL \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18) + +/** + * Returned from nsIChannel::asyncOpen to indicate that OnDataAvailable will + * not be called because there is no content available. + * + * This is used by helper app style protocols (e.g., mailto). + * + * XXX perhaps this should be a success code. + */ +#define NS_ERROR_NO_CONTENT \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 17) + +/** + * The requested action could not be completed while the object is busy. + * + * Implementations of nsIChannel::asyncOpen will commonly return this error + * if the channel has already been opened (and has not yet been closed). + */ +#define NS_ERROR_IN_PROGRESS \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 15) + + +/****************************************************************************** + * Connectivity error codes: + */ + +/** + * The connection is already established. + * XXX currently unused - consider removing. + */ +#define NS_ERROR_ALREADY_CONNECTED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 11) + +/** + * The connection does not exist. + * XXX currently unused - consider removing. + */ +#define NS_ERROR_NOT_CONNECTED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 12) + +/** + * The connection attempt failed, for example, because no server was listening + * at specified host:port. + */ +#define NS_ERROR_CONNECTION_REFUSED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 13) + +/** + * The connection attempt to a proxy failed. + */ +#define NS_ERROR_PROXY_CONNECTION_REFUSED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 72) + +/** + * The connection was lost due to a timeout error. + */ +#define NS_ERROR_NET_TIMEOUT \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 14) + +/** + * The requested action could not be completed while the networking library + * is in the offline state. + */ +#define NS_ERROR_OFFLINE \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 16) + +/** + * The requested action was prohibited because it would have caused the + * networking library to establish a connection to an unsafe or otherwise + * banned port. + */ +#define NS_ERROR_PORT_ACCESS_NOT_ALLOWED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 19) + +/** + * The connection was established, but no data was ever received. + */ +#define NS_ERROR_NET_RESET \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 20) + +/** + * The connection was established, but the data transfer was interrupted. + */ +#define NS_ERROR_NET_INTERRUPT \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 71) + +// XXX really need to better rationalize these error codes. are consumers of +// necko really expected to know how to discern the meaning of these?? + + +/** + * XXX document me + */ +#define NS_ERROR_NOT_RESUMABLE \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 25) + +/** + * The request failed as a result of a detected redirection loop. + */ +#define NS_ERROR_REDIRECT_LOOP \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 31) + + +/****************************************************************************** + * FTP specific error codes: + * + * XXX document me + */ + +#define NS_ERROR_FTP_LOGIN \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 21) + +#define NS_ERROR_FTP_CWD \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 22) + +#define NS_ERROR_FTP_PASV \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 23) + +#define NS_ERROR_FTP_PWD \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 24) + + +/****************************************************************************** + * DNS specific error codes: + */ + +/** + * The lookup of a hostname failed. This generally refers to the hostname + * from the URL being loaded. + */ +#define NS_ERROR_UNKNOWN_HOST \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 30) + +/** + * The lookup of a proxy hostname failed. + * + * If a channel is configured to speak to a proxy server, then it will + * generate this error if the proxy hostname cannot be resolved. + */ +#define NS_ERROR_UNKNOWN_PROXY_HOST \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 42) + + +/****************************************************************************** + * Cache specific error codes: + * + * XXX document me + */ + +#define NS_ERROR_CACHE_KEY_NOT_FOUND \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 61) + +#define NS_ERROR_CACHE_DATA_IS_STREAM \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 62) + +#define NS_ERROR_CACHE_DATA_IS_NOT_STREAM \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 63) + +#define NS_ERROR_CACHE_WAIT_FOR_VALIDATION \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 64) + +#define NS_ERROR_CACHE_ENTRY_DOOMED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 65) + +#define NS_ERROR_CACHE_READ_ACCESS_DENIED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 66) + +#define NS_ERROR_CACHE_WRITE_ACCESS_DENIED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 67) + +/** + * Error passed through onStopRequest if the document could not be fetched + * from the cache. + */ +#define NS_ERROR_DOCUMENT_NOT_CACHED \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 70) + + +#endif // !nsNetError_h__ diff --git a/netwerk/base/src/nsSocketTransport.cpp b/netwerk/base/src/nsSocketTransport.cpp index 573ae0c4bb15..09154f6b002d 100644 --- a/netwerk/base/src/nsSocketTransport.cpp +++ b/netwerk/base/src/nsSocketTransport.cpp @@ -542,7 +542,9 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) mStatus = doConnection(aSelectFlags); // on connection failure, reuse next address if one exists - if (mStatus == NS_ERROR_CONNECTION_REFUSED) { + if (mStatus == NS_ERROR_CONNECTION_REFUSED || + mStatus == NS_ERROR_PROXY_CONNECTION_REFUSED) { + LOG(("connection failed [this=%x error=%x]\n", this, mStatus)); // Try again? @@ -1054,6 +1056,9 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags) sslControl->ProxyStartSSL(); } } + // map to proxy specific error if appropriate. + if (rv == NS_ERROR_CONNECTION_REFUSED && UsingProxy()) + rv = NS_ERROR_PROXY_CONNECTION_REFUSED; return rv; } @@ -1688,20 +1693,22 @@ nsSocketTransport::OnStopLookup(nsISupports *aContext, // If the lookup failed... if (NS_FAILED(aStatus)) { - // Retry? // Don't want to set the tryNextAddress param because DNS lookup has // just failed so hostname has not been resolved yet. if (aStatus != NS_BASE_STREAM_WOULD_BLOCK && OnConnectionFailed(PR_FALSE)) mStatus = NS_OK; - else + else { + // map to proxy unknown error message if lookup was for a proxy. + if (aStatus == NS_ERROR_UNKNOWN_HOST && UsingProxy()) + aStatus = NS_ERROR_UNKNOWN_PROXY_HOST; mStatus = aStatus; + } } else if (mNetAddress == nsnull) { mStatus = NS_ERROR_ABORT; } - // Start processing the transport again - if necessary... if (GetFlag(eSocketDNS_Wait)) { ClearFlag(eSocketDNS_Wait); diff --git a/netwerk/base/src/nsSocketTransport.h b/netwerk/base/src/nsSocketTransport.h index 2257fc0276d1..13d321f27b27 100644 --- a/netwerk/base/src/nsSocketTransport.h +++ b/netwerk/base/src/nsSocketTransport.h @@ -240,8 +240,9 @@ protected: mReadWriteState &= ~aFlag; } - PRInt32 GetSocketPort(void) { return (mProxyPort != -1 && !mProxyTransparent) ? mProxyPort : mPort; } - const char *GetSocketHost(void) { return (mProxyHost && !mProxyTransparent) ? mProxyHost : mHostName; } + PRBool UsingProxy() { return (mProxyHost && !mProxyTransparent); } + const char *GetSocketHost() { return UsingProxy() ? mProxyHost : mHostName; } + PRInt32 GetSocketPort() { return UsingProxy() ? mProxyPort : mPort; } protected: class nsNetAddrList { diff --git a/netwerk/cache/public/nsICache.idl b/netwerk/cache/public/nsICache.idl index 3fff812ba46c..bfa46a32bd5c 100644 --- a/netwerk/cache/public/nsICache.idl +++ b/netwerk/cache/public/nsICache.idl @@ -153,18 +153,6 @@ interface nsICache const long BLOCKING = 1; }; - %{C++ - -/** - * Cache specific nsresult error codes - */ -#define NS_ERROR_CACHE_KEY_NOT_FOUND NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 61) -#define NS_ERROR_CACHE_DATA_IS_STREAM NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 62) -#define NS_ERROR_CACHE_DATA_IS_NOT_STREAM NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 63) -#define NS_ERROR_CACHE_WAIT_FOR_VALIDATION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 64) -#define NS_ERROR_CACHE_ENTRY_DOOMED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 65) -#define NS_ERROR_CACHE_READ_ACCESS_DENIED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 66) -#define NS_ERROR_CACHE_WRITE_ACCESS_DENIED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 67) - +#include "nsNetError.h" %} diff --git a/netwerk/dns/public/nsIDNSService.idl b/netwerk/dns/public/nsIDNSService.idl index 036fe35b37c1..049fe5ea1a94 100644 --- a/netwerk/dns/public/nsIDNSService.idl +++ b/netwerk/dns/public/nsIDNSService.idl @@ -38,6 +38,7 @@ #include "nsISupports.idl" %{C++ +#include "nsNetError.h" #define NS_DNSSERVICE_CID \ { /* 718e7c81-f8b8-11d2-b951-c80918051d3c */ \ @@ -80,9 +81,3 @@ interface nsIDNSService : nsISupports void init(); void shutdown(); }; - -%{C++ - -#define NS_ERROR_UNKNOWN_HOST NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 30) - -%} diff --git a/netwerk/protocol/ftp/public/ftpCore.h b/netwerk/protocol/ftp/public/ftpCore.h index eefd7630ecb5..a024405e4e23 100644 --- a/netwerk/protocol/ftp/public/ftpCore.h +++ b/netwerk/protocol/ftp/public/ftpCore.h @@ -38,31 +38,16 @@ #ifndef __ftpCore_h___ #define __ftpCore_h___ -#include "nsError.h" - -////////////////////////////// -//// FTP CODES RANGE: 20-30 -////////////////////////////// -#define NS_ERROR_FTP_LOGIN \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 21) - -#define NS_ERROR_FTP_CWD \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 22) - -#define NS_ERROR_FTP_PASV \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 23) - -#define NS_ERROR_FTP_PWD \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 24) +#include "nsNetError.h" /** - * Status nsresult codes: used with nsINotification objects + * Status nsresult codes */ #define NS_NET_STATUS_BEGIN_FTP_TRANSACTION \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 27) + NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 27) #define NS_NET_STATUS_END_FTP_TRANSACTION \ - NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 28) + NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 28) #endif // __ftpCore_h___ diff --git a/netwerk/protocol/gopher/src/nsGopherHandler.cpp b/netwerk/protocol/gopher/src/nsGopherHandler.cpp index 42456bd15813..4534db925574 100644 --- a/netwerk/protocol/gopher/src/nsGopherHandler.cpp +++ b/netwerk/protocol/gopher/src/nsGopherHandler.cpp @@ -34,7 +34,6 @@ #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIProgressEventSink.h" -#include "nsIErrorService.h" #include "nsIStandardURL.h" #include "nsNetUtil.h" #include "prlog.h" diff --git a/netwerk/test/TestProtocols.cpp b/netwerk/test/TestProtocols.cpp index 85c4eb7520a8..078309b29e34 100644 --- a/netwerk/test/TestProtocols.cpp +++ b/netwerk/test/TestProtocols.cpp @@ -374,7 +374,8 @@ InputTestConsumer::OnStopRequest(nsIRequest *request, nsISupports* context, printf("\nFinished loading: %s Status Code: %x\n", info->Name(), aStatus); if (bHTTPURL) printf("\tHTTP Status: %u\n", httpStatus); - if (NS_ERROR_UNKNOWN_HOST == aStatus) { + if (NS_ERROR_UNKNOWN_HOST == aStatus || + NS_ERROR_UNKNOWN_PROXY_HOST == aStatus) { printf("\tDNS lookup failed.\n"); } printf("\tTime to connect: %.3f seconds\n", connectTime);