author | Joe Drew <joe@drew.ca> |
Fri, 16 Apr 2010 17:05:47 -0400 | |
changeset 43611 | b1d4b2d369027b73c418d6025de36b159635c843 |
parent 43610 | 135a3b7c23235bb8e8062f20ec5a7d28e4289913 |
child 43612 | 08903a38e2d245eb87e9aef483721ca8a2f19774 |
push id | 1 |
push user | root |
push date | Tue, 26 Apr 2011 22:38:44 +0000 |
treeherder | mozilla-beta@bfdb6e623a36 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jduell, gavin, bz |
bugs | 388195 |
milestone | 1.9.3a6pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/base/content/pageinfo/pageInfo.js +++ b/browser/base/content/pageinfo/pageInfo.js @@ -923,17 +923,17 @@ function makePreview(row) // We couldn't find the type, fall back to the value in the treeview imageType = gImageView.data[row][COL_IMAGE_TYPE]; } setItemValue("imagetypetext", imageType); var imageContainer = document.getElementById("theimagecontainer"); var oldImage = document.getElementById("thepreviewimage"); - const regex = /^(https?|ftp|file|gopher|about|chrome|resource):/; + const regex = /^(https?|ftp|file|about|chrome|resource):/; var isProtocolAllowed = regex.test(url); if (/^data:/.test(url) && /^image\//.test(mimeType)) isProtocolAllowed = true; var newImage = new Image; newImage.id = "thepreviewimage"; var physWidth = 0, physHeight = 0; var width = 0, height = 0;
--- a/browser/components/migration/src/nsDogbertProfileMigrator.cpp +++ b/browser/components/migration/src/nsDogbertProfileMigrator.cpp @@ -402,18 +402,16 @@ nsDogbertProfileMigrator::PrefTransform { "network.cookie.cookieBehavior", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } }, { "network.cookie.warnAboutCookies",0, F(GetBool), F(SetBool), PR_FALSE, { -1 } }, { "javascript.enabled", 0, F(GetBool), F(SetBool), PR_FALSE, { -1 } }, { "network.proxy.type", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } }, { "network.proxy.no_proxies_on", 0, F(GetString), F(SetString), PR_FALSE, { -1 } }, { "network.proxy.autoconfig_url", 0, F(GetString), F(SetString), PR_FALSE, { -1 } }, { "network.proxy.ftp", 0, F(GetString), F(SetString), PR_FALSE, { -1 } }, { "network.proxy.ftp_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } }, - { "network.proxy.gopher", 0, F(GetString), F(SetString), PR_FALSE, { -1 } }, - { "network.proxy.gopher_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } }, { "network.proxy.http", 0, F(GetString), F(SetString), PR_FALSE, { -1 } }, { "network.proxy.http_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } }, { "network.proxy.ssl", 0, F(GetString), F(SetString), PR_FALSE, { -1 } }, { "network.proxy.ssl_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } }, // Prefs with Different Names { "network.hosts.socks_server", "network.proxy.socks", F(GetString), F(SetString), PR_FALSE, { -1 } }, { "network.hosts.socks_serverport", "network.proxy.socks_port", F(GetInt), F(SetInt), PR_FALSE, { -1 } },
--- a/browser/components/migration/src/nsIEProfileMigrator.cpp +++ b/browser/components/migration/src/nsIEProfileMigrator.cpp @@ -2146,29 +2146,27 @@ nsIEProfileMigrator::CopyProxyPreference ParseOverrideServers(buf, aPrefs); if (NS_SUCCEEDED(regKey-> ReadStringValue(NS_LITERAL_STRING("ProxyServer"), buf))) { ProxyData data[] = { { "ftp=", 4, PR_FALSE, "network.proxy.ftp", "network.proxy.ftp_port" }, - { "gopher=", 7, PR_FALSE, "network.proxy.gopher", - "network.proxy.gopher_port" }, { "http=", 5, PR_FALSE, "network.proxy.http", "network.proxy.http_port" }, { "https=", 6, PR_FALSE, "network.proxy.ssl", "network.proxy.ssl_port" }, { "socks=", 6, PR_FALSE, "network.proxy.socks", "network.proxy.socks_port" }, }; PRInt32 startIndex = 0, count = 0; PRBool foundSpecificProxy = PR_FALSE; - for (PRUint32 i = 0; i < 5; ++i) { + for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(data); ++i) { PRInt32 offset = buf.Find(NS_ConvertASCIItoUTF16(data[i].prefix)); if (offset >= 0) { foundSpecificProxy = PR_TRUE; data[i].proxyConfigured = PR_TRUE; startIndex = offset + data[i].prefixLength; @@ -2181,17 +2179,17 @@ nsIEProfileMigrator::CopyProxyPreference data[i].portPref, aPrefs); } } if (!foundSpecificProxy) { // No proxy config for any specific type was found, assume // the ProxyServer value is of the form host:port and that // it applies to all protocols. - for (PRUint32 i = 0; i < 5; ++i) + for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(data); ++i) SetProxyPref(buf, data[i].hostPref, data[i].portPref, aPrefs); aPrefs->SetBoolPref("network.proxy.share_proxy_settings", PR_TRUE); } } } return NS_OK;
--- a/browser/components/migration/src/nsOperaProfileMigrator.cpp +++ b/browser/components/migration/src/nsOperaProfileMigrator.cpp @@ -481,22 +481,22 @@ nsOperaProfileMigrator::CopyPreferences( nsresult nsOperaProfileMigrator::CopyProxySettings(nsINIParser &aParser, nsIPrefBranch* aBranch) { nsresult rv; PRInt32 networkProxyType = 0; - const char* protocols[4] = { "HTTP", "HTTPS", "FTP", "GOPHER" }; - const char* protocols_l[4] = { "http", "https", "ftp", "gopher" }; + const char* protocols[] = { "HTTP", "HTTPS", "FTP" }; + const char* protocols_l[] = { "http", "https", "ftp" }; char toggleBuf[15], serverBuf[20], serverPrefBuf[20], serverPortPrefBuf[25]; PRInt32 enabled; - for (PRUint32 i = 0; i < 4; ++i) { + for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(protocols); ++i) { sprintf(toggleBuf, "Use %s", protocols[i]); GetInteger(aParser, "Proxy", toggleBuf, &enabled); if (enabled) { // Enable the "manual configuration" setting if we have at least // one protocol using a Proxy. networkProxyType = 1; }
--- a/browser/components/migration/src/nsSeamonkeyProfileMigrator.cpp +++ b/browser/components/migration/src/nsSeamonkeyProfileMigrator.cpp @@ -381,18 +381,16 @@ nsSeamonkeyProfileMigrator::PrefTransfor MAKESAMETYPEPREFTRANSFORM("network.proxy.http", String), MAKESAMETYPEPREFTRANSFORM("network.proxy.http_port", Int), MAKESAMETYPEPREFTRANSFORM("network.proxy.ftp", String), MAKESAMETYPEPREFTRANSFORM("network.proxy.ftp_port", Int), MAKESAMETYPEPREFTRANSFORM("network.proxy.ssl", String), MAKESAMETYPEPREFTRANSFORM("network.proxy.ssl_port", Int), MAKESAMETYPEPREFTRANSFORM("network.proxy.socks", String), MAKESAMETYPEPREFTRANSFORM("network.proxy.socks_port", Int), - MAKESAMETYPEPREFTRANSFORM("network.proxy.gopher", String), - MAKESAMETYPEPREFTRANSFORM("network.proxy.gopher_port", Int), MAKESAMETYPEPREFTRANSFORM("network.proxy.no_proxies_on", String), MAKESAMETYPEPREFTRANSFORM("network.proxy.autoconfig_url", String), MAKESAMETYPEPREFTRANSFORM("browser.display.foreground_color", String), MAKESAMETYPEPREFTRANSFORM("browser.display.background_color", String), MAKESAMETYPEPREFTRANSFORM("browser.anchor_color", String), MAKESAMETYPEPREFTRANSFORM("browser.visited_color", String), MAKESAMETYPEPREFTRANSFORM("browser.underline_anchors", Bool), MAKESAMETYPEPREFTRANSFORM("browser.display.use_system_colors", Bool),
--- a/browser/components/preferences/connection.js +++ b/browser/components/preferences/connection.js @@ -47,17 +47,17 @@ var gConnectionsDialog = { if (proxyTypePref.value != 1) return true; var httpProxyURLPref = document.getElementById("network.proxy.http"); var httpProxyPortPref = document.getElementById("network.proxy.http_port"); var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings"); if (shareProxiesPref.value) { - var proxyPrefs = ["ssl", "ftp", "socks", "gopher"]; + var proxyPrefs = ["ssl", "ftp", "socks"]; for (var i = 0; i < proxyPrefs.length; ++i) { var proxyServerURLPref = document.getElementById("network.proxy." + proxyPrefs[i]); var proxyPortPref = document.getElementById("network.proxy." + proxyPrefs[i] + "_port"); var backupServerURLPref = document.getElementById("network.proxy.backup." + proxyPrefs[i]); var backupPortPref = document.getElementById("network.proxy.backup." + proxyPrefs[i] + "_port"); backupServerURLPref.value = proxyServerURLPref.value; backupPortPref.value = proxyPortPref.value; proxyServerURLPref.value = httpProxyURLPref.value; @@ -129,17 +129,17 @@ var gConnectionsDialog = { this.proxyTypeChanged(); return undefined; }, updateProtocolPrefs: function () { var proxyTypePref = document.getElementById("network.proxy.type"); var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings"); - var proxyPrefs = ["ssl", "ftp", "socks", "gopher"]; + var proxyPrefs = ["ssl", "ftp", "socks"]; for (var i = 0; i < proxyPrefs.length; ++i) { var proxyServerURLPref = document.getElementById("network.proxy." + proxyPrefs[i]); var proxyPortPref = document.getElementById("network.proxy." + proxyPrefs[i] + "_port"); // Restore previous per-proxy custom settings, if present. if (!shareProxiesPref.value) { var backupServerURLPref = document.getElementById("network.proxy.backup." + proxyPrefs[i]); var backupPortPref = document.getElementById("network.proxy.backup." + proxyPrefs[i] + "_port");
--- a/browser/components/preferences/connection.xul +++ b/browser/components/preferences/connection.xul @@ -65,18 +65,16 @@ <preference id="network.proxy.http" name="network.proxy.http" type="string"/> <preference id="network.proxy.http_port" name="network.proxy.http_port" type="int"/> <preference id="network.proxy.ftp" name="network.proxy.ftp" type="string"/> <preference id="network.proxy.ftp_port" name="network.proxy.ftp_port" type="int"/> <preference id="network.proxy.ssl" name="network.proxy.ssl" type="string"/> <preference id="network.proxy.ssl_port" name="network.proxy.ssl_port" type="int"/> <preference id="network.proxy.socks" name="network.proxy.socks" type="string"/> <preference id="network.proxy.socks_port" name="network.proxy.socks_port" type="int"/> - <preference id="network.proxy.gopher" name="network.proxy.gopher" type="string"/> - <preference id="network.proxy.gopher_port" name="network.proxy.gopher_port" type="int"/> <preference id="network.proxy.socks_version" name="network.proxy.socks_version" type="int"/> <preference id="network.proxy.no_proxies_on" name="network.proxy.no_proxies_on" type="string"/> <preference id="network.proxy.autoconfig_url" name="network.proxy.autoconfig_url" type="string"/> <preference id="network.proxy.share_proxy_settings" name="network.proxy.share_proxy_settings" type="bool"/> <preference id="pref.advanced.proxies.disable_button.reload" @@ -84,18 +82,16 @@ type="bool"/> <preference id="network.proxy.backup.ftp" name="network.proxy.backup.ftp" type="string"/> <preference id="network.proxy.backup.ftp_port" name="network.proxy.backup.ftp_port" type="int"/> <preference id="network.proxy.backup.ssl" name="network.proxy.backup.ssl" type="string"/> <preference id="network.proxy.backup.ssl_port" name="network.proxy.backup.ssl_port" type="int"/> <preference id="network.proxy.backup.socks" name="network.proxy.backup.socks" type="string"/> <preference id="network.proxy.backup.socks_port" name="network.proxy.backup.socks_port" type="int"/> - <preference id="network.proxy.backup.gopher" name="network.proxy.backup.gopher" type="string"/> - <preference id="network.proxy.backup.gopher_port" name="network.proxy.backup.gopher_port" type="int"/> </preferences> <script type="application/javascript" src="chrome://browser/content/preferences/connection.js"/> <stringbundle id="preferencesBundle" src="chrome://browser/locale/preferences/preferences.properties"/> <groupbox> <caption label="&proxyTitle.label;"/> @@ -153,28 +149,16 @@ onsyncfrompreference="return gConnectionsDialog.readProxyProtocolPref('ftp', false);"/> <label value="&port.label;" accesskey="&FTPport.accesskey;" control="networkProxyFTP_Port"/> <textbox id="networkProxyFTP_Port" type="number" max="65535" size="5" preference="network.proxy.ftp_port" onsyncfrompreference="return gConnectionsDialog.readProxyProtocolPref('ftp', true);"/> </hbox> </row> <row align="center"> <hbox pack="end"> - <label value="&gopher.label;" accesskey="&gopher.accesskey;" control="networkProxyGopher"/> - </hbox> - <hbox align="center"> - <textbox id="networkProxyGopher" flex="1" preference="network.proxy.gopher" - onsyncfrompreference="return gConnectionsDialog.readProxyProtocolPref('gopher', false);"/> - <label value="&port.label;" accesskey="&gopherPort.accesskey;" control="networkProxyGopher_Port"/> - <textbox id="networkProxyGopher_Port" type="number" max="65535" size="5" preference="network.proxy.gopher_port" - onsyncfrompreference="return gConnectionsDialog.readProxyProtocolPref('gopher', true);"/> - </hbox> - </row> - <row align="center"> - <hbox pack="end"> <label value="&socks.label;" accesskey="&socks.accesskey;" control="networkProxySOCKS"/> </hbox> <hbox align="center"> <textbox id="networkProxySOCKS" flex="1" preference="network.proxy.socks" onsyncfrompreference="return gConnectionsDialog.readProxyProtocolPref('socks', false);"/> <label value="&port.label;" accesskey="&SOCKSport.accesskey;" control="networkProxySOCKS_Port"/> <textbox id="networkProxySOCKS_Port" type="number" max="65535" size="5" preference="network.proxy.socks_port" onsyncfrompreference="return gConnectionsDialog.readProxyProtocolPref('socks', true);"/>
--- a/browser/locales/en-US/chrome/browser/preferences/connection.dtd +++ b/browser/locales/en-US/chrome/browser/preferences/connection.dtd @@ -13,32 +13,28 @@ <!ENTITY manualTypeRadio.label "Manual proxy configuration:"> <!ENTITY manualTypeRadio.accesskey "m"> <!ENTITY autoTypeRadio.label "Automatic proxy configuration URL:"> <!ENTITY autoTypeRadio.accesskey "A"> <!ENTITY reload.label "Reload"> <!ENTITY reload.accesskey "e"> <!ENTITY ftp.label "FTP Proxy:"> <!ENTITY ftp.accesskey "F"> -<!ENTITY gopher.label "Gopher Proxy:"> -<!ENTITY gopher.accesskey "G"> <!ENTITY http.label "HTTP Proxy:"> <!ENTITY http.accesskey "x"> <!ENTITY ssl.label "SSL Proxy:"> <!ENTITY ssl.accesskey "L"> <!ENTITY socks.label "SOCKS Host:"> <!ENTITY socks.accesskey "C"> <!ENTITY socks4.label "SOCKS v4"> <!ENTITY socks4.accesskey "K"> <!ENTITY socks5.label "SOCKS v5"> <!ENTITY socks5.accesskey "v"> <!ENTITY port.label "Port:"> <!ENTITY HTTPport.accesskey "P"> <!ENTITY SSLport.accesskey "o"> <!ENTITY FTPport.accesskey "r"> -<!-- No accesskey for gopher (':' doesn't go well) - mpt's going to redesign the window --> -<!ENTITY gopherPort.accesskey ""> <!ENTITY SOCKSport.accesskey "t"> <!ENTITY noproxy.label "No Proxy for:"> <!ENTITY noproxy.accesskey "n"> <!ENTITY noproxyExplain.label "Example: .mozilla.org, .net.nz, 192.168.1.0/24"> <!ENTITY shareproxy.label "Use this proxy server for all protocols"> <!ENTITY shareproxy.accesskey "s">
--- a/configure.in +++ b/configure.in @@ -4945,17 +4945,17 @@ MOZ_XSLT_STANDALONE= MOZ_XTF=1 MOZ_XUL=1 MOZ_ZIPWRITER=1 NS_PRINTING=1 NSS_DISABLE_DBM= NECKO_WIFI=1 NECKO_COOKIES=1 NECKO_DISK_CACHE=1 -NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource" +NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource" USE_ARM_KUSER= BUILD_CTYPES=1 XPC_IDISPATCH_SUPPORT= case "$target_os" in darwin*|*wince*|*winmo*) ACCESSIBILITY=
--- a/extensions/reporter/resources/content/reporter/reporterOverlay.js +++ b/extensions/reporter/resources/content/reporter/reporterOverlay.js @@ -51,17 +51,16 @@ var reporterListener = { var broadcaster = document.getElementById("reporterItemsBroadcaster"); var isEnabled = false; if (aURI instanceof Components.interfaces.nsIURI) { switch (aURI.scheme) { case "http": case "https": case "ftp": - case "gopher": isEnabled = true; } } broadcaster.setAttribute("disabled", !isEnabled); }, onStateChange: function() { },
--- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -705,18 +705,16 @@ pref("network.http.prompt-temp-redirect" // since inappropriate marking can easily overwhelm bandwidth reservations // for certain services (i.e. EF for VoIP, AF4x for interactive video, // AF3x for broadcast/streaming video, etc) // default value for HTTP // in a DSCP environment this should be 40 (0x28, or AF11), per RFC-4594, // Section 4.8 "High-Throughput Data Service Class" pref("network.http.qos", 0); -// ditto for Gopher -pref("network.gopher.qos", 0); // default values for FTP // in a DSCP environment this should be 40 (0x28, or AF11), per RFC-4594, // Section 4.8 "High-Throughput Data Service Class", and 80 (0x50, or AF22) // per Section 4.7 "Low-Latency Data Service Class". pref("network.ftp.data.qos", 0); pref("network.ftp.control.qos", 0); @@ -902,18 +900,16 @@ pref("network.automatic-ntlm-auth.truste // implementation will not be affected by this preference. pref("network.ntlm.send-lm-response", false); pref("permissions.default.image", 1); // 1-Accept, 2-Deny, 3-dontAcceptForeign pref("network.proxy.type", 5); pref("network.proxy.ftp", ""); pref("network.proxy.ftp_port", 0); -pref("network.proxy.gopher", ""); -pref("network.proxy.gopher_port", 0); pref("network.proxy.http", ""); pref("network.proxy.http_port", 0); pref("network.proxy.ssl", ""); pref("network.proxy.ssl_port", 0); pref("network.proxy.socks", ""); pref("network.proxy.socks_port", 0); pref("network.proxy.socks_version", 5); pref("network.proxy.socks_remote_dns", false);
--- a/netwerk/base/src/nsProtocolProxyService.cpp +++ b/netwerk/base/src/nsProtocolProxyService.cpp @@ -296,17 +296,16 @@ NS_IMPL_CI_INTERFACE_GETTER2(nsProtocolP nsIProtocolProxyService, nsIProtocolProxyService2) nsProtocolProxyService::nsProtocolProxyService() : mFilters(nsnull) , mProxyConfig(eProxyConfig_Direct) , mHTTPProxyPort(-1) , mFTPProxyPort(-1) - , mGopherProxyPort(-1) , mHTTPSProxyPort(-1) , mSOCKSProxyPort(-1) , mSOCKSProxyVersion(4) , mSOCKSProxyRemoteDNS(PR_FALSE) , mPACMan(nsnull) , mSessionStart(PR_Now()) , mFailedProxyTimeout(30 * 60) // 30 minute default { @@ -425,22 +424,16 @@ nsProtocolProxyService::PrefsChanged(nsI proxy_GetIntPref(prefBranch, PROXY_PREF("ssl_port"), mHTTPSProxyPort); if (!pref || !strcmp(pref, PROXY_PREF("ftp"))) proxy_GetStringPref(prefBranch, PROXY_PREF("ftp"), mFTPProxyHost); if (!pref || !strcmp(pref, PROXY_PREF("ftp_port"))) proxy_GetIntPref(prefBranch, PROXY_PREF("ftp_port"), mFTPProxyPort); - if (!pref || !strcmp(pref, PROXY_PREF("gopher"))) - proxy_GetStringPref(prefBranch, PROXY_PREF("gopher"), mGopherProxyHost); - - if (!pref || !strcmp(pref, PROXY_PREF("gopher_port"))) - proxy_GetIntPref(prefBranch, PROXY_PREF("gopher_port"), mGopherProxyPort); - if (!pref || !strcmp(pref, PROXY_PREF("socks"))) proxy_GetStringPref(prefBranch, PROXY_PREF("socks"), mSOCKSProxyHost); if (!pref || !strcmp(pref, PROXY_PREF("socks_port"))) proxy_GetIntPref(prefBranch, PROXY_PREF("socks_port"), mSOCKSProxyPort); if (!pref || !strcmp(pref, PROXY_PREF("socks_version"))) { PRInt32 version; @@ -1294,22 +1287,16 @@ nsProtocolProxyService::Resolve_Internal port = mHTTPSProxyPort; } else if (!mFTPProxyHost.IsEmpty() && mFTPProxyPort > 0 && info.scheme.EqualsLiteral("ftp")) { host = &mFTPProxyHost; type = kProxyType_HTTP; port = mFTPProxyPort; } - else if (!mGopherProxyHost.IsEmpty() && mGopherProxyPort > 0 && - info.scheme.EqualsLiteral("gopher")) { - host = &mGopherProxyHost; - type = kProxyType_HTTP; - port = mGopherProxyPort; - } else if (!mSOCKSProxyHost.IsEmpty() && mSOCKSProxyPort > 0) { host = &mSOCKSProxyHost; if (mSOCKSProxyVersion == 4) type = kProxyType_SOCKS4; else type = kProxyType_SOCKS; port = mSOCKSProxyPort; if (mSOCKSProxyRemoteDNS)
--- a/netwerk/base/src/nsProtocolProxyService.h +++ b/netwerk/base/src/nsProtocolProxyService.h @@ -360,19 +360,16 @@ protected: ProxyConfig mProxyConfig; nsCString mHTTPProxyHost; PRInt32 mHTTPProxyPort; nsCString mFTPProxyHost; PRInt32 mFTPProxyPort; - nsCString mGopherProxyHost; - PRInt32 mGopherProxyPort; - nsCString mHTTPSProxyHost; PRInt32 mHTTPSProxyPort; nsCString mSOCKSProxyHost; PRInt32 mSOCKSProxyPort; PRInt32 mSOCKSProxyVersion; PRBool mSOCKSProxyRemoteDNS;
--- a/netwerk/build/nsNetModule.cpp +++ b/netwerk/build/nsNetModule.cpp @@ -245,21 +245,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpDig #ifdef NECKO_PROTOCOL_res // resource #include "nsResProtocolHandler.h" NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsResProtocolHandler, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(nsResURL) #endif -#ifdef NECKO_PROTOCOL_gopher -#include "nsGopherHandler.h" -NS_GENERIC_FACTORY_CONSTRUCTOR(nsGopherHandler) -#endif - #ifdef NECKO_PROTOCOL_viewsource #include "nsViewSourceHandler.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewSourceHandler) #endif #ifdef NECKO_PROTOCOL_data #include "nsDataHandler.h" #endif @@ -302,21 +297,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMa /////////////////////////////////////////////////////////////////////////////// #ifdef NECKO_PROTOCOL_ftp #include "nsFTPDirListingConv.h" nsresult NS_NewFTPDirListingConv(nsFTPDirListingConv** result); #endif -#ifdef NECKO_PROTOCOL_gopher -#include "nsGopherDirListingConv.h" -NS_GENERIC_FACTORY_CONSTRUCTOR(nsGopherDirListingConv) -#endif - #include "nsMultiMixedConv.h" #include "nsHTTPCompressConv.h" #include "mozTXTToHTMLConv.h" #include "nsUnknownDecoder.h" #include "nsTXTToHTMLConv.h" #include "nsIndexedToHTML.h" #ifdef BUILD_BINHEX_DECODER #include "nsBinHexDecoder.h" @@ -324,17 +314,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsGopherD nsresult NS_NewMultiMixedConv (nsMultiMixedConv** result); nsresult MOZ_NewTXTToHTMLConv (mozTXTToHTMLConv** result); nsresult NS_NewHTTPCompressConv (nsHTTPCompressConv ** result); nsresult NS_NewNSTXTToHTMLConv(nsTXTToHTMLConv** result); nsresult NS_NewStreamConv(nsStreamConverterService **aStreamConv); #define FTP_TO_INDEX "?from=text/ftp-dir&to=application/http-index-format" -#define GOPHER_TO_INDEX "?from=text/gopher-dir&to=application/http-index-format" #define INDEX_TO_HTML "?from=application/http-index-format&to=text/html" #define MULTI_MIXED_X "?from=multipart/x-mixed-replace&to=*/*" #define MULTI_MIXED "?from=multipart/mixed&to=*/*" #define MULTI_BYTERANGES "?from=multipart/byteranges&to=*/*" #define UNKNOWN_CONTENT "?from=" UNKNOWN_CONTENT_TYPE "&to=*/*" #define GZIP_TO_UNCOMPRESSED "?from=gzip&to=uncompressed" #define XGZIP_TO_UNCOMPRESSED "?from=x-gzip&to=uncompressed" #define COMPRESS_TO_UNCOMPRESSED "?from=compress&to=uncompressed" @@ -343,17 +332,16 @@ nsresult NS_NewStreamConv(nsStreamConver #define PLAIN_TO_HTML "?from=text/plain&to=text/html" #ifdef BUILD_BINHEX_DECODER #define BINHEX_TO_WILD "?from=application/mac-binhex40&to=*/*" #endif static const char *const sStreamConverterArray[] = { FTP_TO_INDEX, - GOPHER_TO_INDEX, INDEX_TO_HTML, MULTI_MIXED_X, MULTI_MIXED, MULTI_BYTERANGES, UNKNOWN_CONTENT, GZIP_TO_UNCOMPRESSED, XGZIP_TO_UNCOMPRESSED, COMPRESS_TO_UNCOMPRESSED, @@ -836,24 +824,16 @@ static const nsModuleComponentInfo gNetM // from netwerk/streamconv/converters: { "FTPDirListingConverter", NS_FTPDIRLISTINGCONVERTER_CID, NS_ISTREAMCONVERTER_KEY FTP_TO_INDEX, CreateNewFTPDirListingConv }, #endif -#ifdef NECKO_PROTOCOL_gopher - { "GopherDirListingConverter", - NS_GOPHERDIRLISTINGCONVERTER_CID, - NS_ISTREAMCONVERTER_KEY GOPHER_TO_INDEX, - nsGopherDirListingConvConstructor - }, -#endif - { "Indexed to HTML Converter", NS_NSINDEXEDTOHTMLCONVERTER_CID, NS_ISTREAMCONVERTER_KEY INDEX_TO_HTML, nsIndexedToHTML::Create }, { "Directory Index Parser", NS_DIRINDEXPARSER_CID, @@ -1120,25 +1100,16 @@ static const nsModuleComponentInfo gNetM { NS_WIFI_MONITOR_CLASSNAME, NS_WIFI_MONITOR_COMPONENT_CID, NS_WIFI_MONITOR_CONTRACTID, nsWifiMonitorConstructor }, #endif -#ifdef NECKO_PROTOCOL_gopher - //gopher: - { "The Gopher Protocol Handler", - NS_GOPHERHANDLER_CID, - NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "gopher", - nsGopherHandlerConstructor - }, -#endif - #ifdef NECKO_PROTOCOL_data // from netwerk/protocol/data: { "Data Protocol Handler", NS_DATAPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "data", nsDataHandler::Create}, #endif
--- a/netwerk/locales/en-US/necko.properties +++ b/netwerk/locales/en-US/necko.properties @@ -59,16 +59,12 @@ RepostFormData=This web page is being re DirTitle=Index of %1$S DirGoUp=Up to higher level directory ShowHidden=Show hidden objects DirColName=Name DirColSize=Size DirColMTime=Last Modified DirFileLabel=File: -#Gopher Search Prompt -GopherPromptTitle=Search -GopherPromptText=Enter a search term: - PhishingAuth=You are about to visit "%1$S". This site may be attempting to trick you into thinking you are visiting a different site. Use extreme caution. PhishingAuthAccept=I understand and will be very careful SuperfluousAuth=You are about to log in to the site "%1$S" with the username "%2$S", but the website does not require authentication. This may be an attempt to trick you.\n\nIs "%1$S" the site you want to visit? AutomaticAuth=You are about to log in to the site "%1$S" with the username "%2$S".
--- a/netwerk/necko-config.h.in +++ b/netwerk/necko-config.h.in @@ -42,14 +42,13 @@ #undef NECKO_COOKIES #undef NECKO_WIFI #undef NECKO_PROTOCOL_about #undef NECKO_PROTOCOL_data #undef NECKO_PROTOCOL_file #undef NECKO_PROTOCOL_ftp -#undef NECKO_PROTOCOL_gopher #undef NECKO_PROTOCOL_http #undef NECKO_PROTOCOL_res #undef NECKO_PROTOCOL_viewsource #endif
--- a/netwerk/protocol/Makefile.in +++ b/netwerk/protocol/Makefile.in @@ -42,17 +42,16 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk PARALLEL_DIRS = \ about \ data \ file \ ftp \ - gopher \ http \ res \ viewsource \ $(NULL) include $(topsrcdir)/config/rules.mk DEFINES += -DIMPL_NS_NET
deleted file mode 100644 --- a/netwerk/protocol/gopher/Makefile.in +++ /dev/null @@ -1,61 +0,0 @@ -# -# ***** 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.org code. -# -# The Initial Developer of the Original Code is -# Bradley Baetz. -# Portions created by the Initial Developer are Copyright (C) 2000 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Bradley Baetz <bbaetz@student.usyd.edu.au> -# -# 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 ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = nkgopher_s -LIBXUL_LIBRARY = 1 - -FORCE_STATIC_LIB = 1 - -CPPSRCS = \ - nsGopherHandler.cpp \ - nsGopherChannel.cpp \ - $(NULL) - -LOCAL_INCLUDES = \ - -I$(srcdir)/../../base/src \ - $(NULL) - -include $(topsrcdir)/config/rules.mk
deleted file mode 100644 --- a/netwerk/protocol/gopher/nsGopherChannel.cpp +++ /dev/null @@ -1,498 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:set ts=4 sw=4 sts=4 cin et: - * - * ***** 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 the Gopher protocol code. - * - * The Initial Developer of the Original Code is - * Bradley Baetz. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Bradley Baetz <bbaetz@student.usyd.edu.au> - * Darin Fisher <darin@netscape.com> - * - * 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 ***** */ - -#include "nsGopherChannel.h" -#include "nsGopherHandler.h" -#include "nsBaseContentStream.h" -#include "nsIAsyncInputStream.h" -#include "nsIAsyncOutputStream.h" -#include "nsISocketTransportService.h" -#include "nsISocketTransport.h" -#include "nsIStringBundle.h" -#include "nsITXTToHTMLConv.h" -#include "nsIPrompt.h" -#include "nsServiceManagerUtils.h" -#include "nsThreadUtils.h" -#include "nsStreamUtils.h" -#include "nsMimeTypes.h" -#include "nsNetCID.h" -#include "nsCOMPtr.h" -#include "nsAutoPtr.h" -#include "nsEscape.h" -#include "nsCRT.h" -#include "netCore.h" - -// Specifies the maximum number of output stream buffer segments that we can -// allocate before giving up. At 4k per segment, this corresponds to a max -// gopher request of 400k, which should be plenty. -#define GOPHER_MAX_WRITE_SEGMENT_COUNT 100 - -//----------------------------------------------------------------------------- - -class nsGopherContentStream : public nsBaseContentStream - , public nsIInputStreamCallback - , public nsIOutputStreamCallback -{ -public: - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIINPUTSTREAMCALLBACK - NS_DECL_NSIOUTPUTSTREAMCALLBACK - - // stream methods that we override: - NS_IMETHOD Available(PRUint32 *result); - NS_IMETHOD ReadSegments(nsWriteSegmentFun writer, void *closure, - PRUint32 count, PRUint32 *result); - NS_IMETHOD CloseWithStatus(nsresult status); - - nsGopherContentStream(nsGopherChannel *channel) - : nsBaseContentStream(PR_TRUE) // non-blocking - , mChannel(channel) { - } - - nsresult OpenSocket(nsIEventTarget *target); - nsresult OnSocketWritable(); - nsresult ParseTypeAndSelector(char &type, nsCString &selector); - nsresult PromptForQueryString(nsCString &result); - void UpdateContentType(char type); - nsresult SendRequest(); - -protected: - virtual void OnCallbackPending(); - -private: - nsRefPtr<nsGopherChannel> mChannel; - nsCOMPtr<nsISocketTransport> mSocket; - nsCOMPtr<nsIAsyncOutputStream> mSocketOutput; - nsCOMPtr<nsIAsyncInputStream> mSocketInput; -}; - -NS_IMPL_ISUPPORTS_INHERITED2(nsGopherContentStream, - nsBaseContentStream, - nsIInputStreamCallback, - nsIOutputStreamCallback) - -NS_IMETHODIMP -nsGopherContentStream::Available(PRUint32 *result) -{ - if (mSocketInput) - return mSocketInput->Available(result); - - return nsBaseContentStream::Available(result); -} - -NS_IMETHODIMP -nsGopherContentStream::ReadSegments(nsWriteSegmentFun writer, void *closure, - PRUint32 count, PRUint32 *result) -{ - // Insert a thunk here so that the input stream passed to the writer is - // this input stream instead of mSocketInput. - if (mSocketInput) { - nsWriteSegmentThunk thunk = { this, writer, closure }; - return mSocketInput->ReadSegments(NS_WriteSegmentThunk, &thunk, count, - result); - } - - return nsBaseContentStream::ReadSegments(writer, closure, count, result); -} - -NS_IMETHODIMP -nsGopherContentStream::CloseWithStatus(nsresult status) -{ - if (mSocket) { - mSocket->Close(status); - mSocket = nsnull; - mSocketInput = nsnull; - mSocketOutput = nsnull; - } - return nsBaseContentStream::CloseWithStatus(status); -} - -NS_IMETHODIMP -nsGopherContentStream::OnInputStreamReady(nsIAsyncInputStream *stream) -{ - // Forward this notification - DispatchCallbackSync(); - return NS_OK; -} - -NS_IMETHODIMP -nsGopherContentStream::OnOutputStreamReady(nsIAsyncOutputStream *stream) -{ - // If we're already closed, mSocketOutput is going to be null and we'll - // just be getting notified that it got closed (by outselves). In that - // case, nothing to do here. - if (!mSocketOutput) { - NS_ASSERTION(NS_FAILED(Status()), "How did that happen?"); - return NS_OK; - } - - // We have to close ourselves if we hit an error here in order to propagate - // the error to our consumer. Otherwise, just forward the notification so - // that the consumer will know to start reading. - - nsresult rv = OnSocketWritable(); - if (NS_FAILED(rv)) - CloseWithStatus(rv); - - return NS_OK; -} - -void -nsGopherContentStream::OnCallbackPending() -{ - nsresult rv; - - // We have a callback, so failure means we should close the stream. - if (!mSocket) { - rv = OpenSocket(CallbackTarget()); - } else if (mSocketInput) { - rv = mSocketInput->AsyncWait(this, 0, 0, CallbackTarget()); - } - - if (NS_FAILED(rv)) - CloseWithStatus(rv); -} - -nsresult -nsGopherContentStream::OpenSocket(nsIEventTarget *target) -{ - // This function is called to get things started. - - // We begin by opening a socket to the specified host and wait for the - // socket to become writable. - - nsCAutoString host; - nsresult rv = mChannel->URI()->GetAsciiHost(host); - if (NS_FAILED(rv)) - return rv; - if (host.IsEmpty()) - return NS_ERROR_MALFORMED_URI; - - // For security reasons, don't allow anything expect the default - // gopher port (70). See bug 71916 - bbaetz@cs.mcgill.ca - PRInt32 port = GOPHER_PORT; - - // Create socket tranport - nsCOMPtr<nsISocketTransportService> sts = - do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); - if (NS_FAILED(rv)) - return rv; - rv = sts->CreateTransport(nsnull, 0, host, port, mChannel->ProxyInfo(), - getter_AddRefs(mSocket)); - if (NS_FAILED(rv)) - return rv; - - mSocket->SetQoSBits(gGopherHandler->GetQoSBits()); - - // Setup progress and status notifications - rv = mSocket->SetEventSink(mChannel, target); - if (NS_FAILED(rv)) - return rv; - - nsCOMPtr<nsIOutputStream> output; - rv = mSocket->OpenOutputStream(0, 0, GOPHER_MAX_WRITE_SEGMENT_COUNT, - getter_AddRefs(output)); - if (NS_FAILED(rv)) - return rv; - mSocketOutput = do_QueryInterface(output); - NS_ENSURE_STATE(mSocketOutput); - - return mSocketOutput->AsyncWait(this, 0, 0, target); -} - -nsresult -nsGopherContentStream::OnSocketWritable() -{ - // Write to output stream (we can do this in one big chunk) - nsresult rv = SendRequest(); - if (NS_FAILED(rv)) - return rv; - - // Open input stream - nsCOMPtr<nsIInputStream> input; - rv = mSocket->OpenInputStream(0, 0, 0, getter_AddRefs(input)); - if (NS_FAILED(rv)) - return rv; - mSocketInput = do_QueryInterface(input, &rv); - - NS_ASSERTION(CallbackTarget(), "where is my pending callback?"); - rv = mSocketInput->AsyncWait(this, 0, 0, CallbackTarget()); - - return rv; -} - -nsresult -nsGopherContentStream::ParseTypeAndSelector(char &type, nsCString &selector) -{ - nsCAutoString buffer; - nsresult rv = mChannel->URI()->GetPath(buffer); // unescaped down below - if (NS_FAILED(rv)) - return rv; - - // No path given - if (buffer[0] == '\0' || (buffer[0] == '/' && buffer[1] == '\0')) { - type = '1'; - selector.Truncate(); - } else { - NS_ENSURE_STATE(buffer[1] != '\0'); - - type = buffer[1]; // Ignore leading '/' - - // Do it this way in case selector contains embedded nulls after - // unescaping. - char *sel = buffer.BeginWriting() + 2; - PRInt32 count = nsUnescapeCount(sel); - selector.Assign(sel, count); - - // NOTE: FindCharInSet cannot be used to search for a null byte. - if (selector.FindCharInSet("\t\n\r") != kNotFound || - selector.FindChar('\0') != kNotFound) { - // gopher selectors cannot containt tab, cr, lf, or \0 - return NS_ERROR_MALFORMED_URI; - } - } - - return NS_OK; -} - -nsresult -nsGopherContentStream::PromptForQueryString(nsCString &result) -{ - nsCOMPtr<nsIPrompt> prompter; - mChannel->GetCallback(prompter); - if (!prompter) { - NS_ERROR("We need a prompter!"); - return NS_ERROR_FAILURE; - } - - nsCOMPtr<nsIStringBundle> bundle; - nsCOMPtr<nsIStringBundleService> bundleSvc = - do_GetService(NS_STRINGBUNDLE_CONTRACTID); - if (bundleSvc) - bundleSvc->CreateBundle(NECKO_MSGS_URL, getter_AddRefs(bundle)); - - nsXPIDLString promptTitle, promptText; - if (bundle) { - bundle->GetStringFromName(NS_LITERAL_STRING("GopherPromptTitle").get(), - getter_Copies(promptTitle)); - bundle->GetStringFromName(NS_LITERAL_STRING("GopherPromptText").get(), - getter_Copies(promptText)); - } - if (promptTitle.IsEmpty()) - promptTitle.AssignLiteral("Search"); - if (promptText.IsEmpty()) - promptText.AssignLiteral("Enter a search term:"); - - nsXPIDLString value; - PRBool res = PR_FALSE; - PRBool checkState; - prompter->Prompt(promptTitle.get(), promptText.get(), - getter_Copies(value), NULL, &checkState, &res); - if (!res || value.IsEmpty()) - return NS_ERROR_FAILURE; - - CopyUTF16toUTF8(value, result); // XXX Is UTF-8 the right thing? - return NS_OK; -} - -void -nsGopherContentStream::UpdateContentType(char type) -{ - const char *contentType = nsnull; - - switch(type) { - case '0': - case 'h': - case '2': // CSO search - unhandled, should not be selectable - case '3': // "Error" - should not be selectable - case 'i': // info line- should not be selectable - contentType = TEXT_HTML; - break; - case '1': - case '7': // search - returns a directory listing - contentType = APPLICATION_HTTP_INDEX_FORMAT; - break; - case 'g': - case 'I': - contentType = IMAGE_GIF; - break; - case 'T': // tn3270 - type doesn't make sense - case '8': // telnet - type doesn't make sense - contentType = TEXT_PLAIN; - break; - case '5': // "DOS binary archive of some sort" - is the mime-type correct? - case '9': // "Binary file!" - contentType = APPLICATION_OCTET_STREAM; - break; - case '4': // "BinHexed Macintosh file" - contentType = APPLICATION_BINHEX; - break; - case '6': - contentType = APPLICATION_UUENCODE; - break; - } - - if (contentType) - mChannel->SetContentType(nsDependentCString(contentType)); -} - -nsresult -nsGopherContentStream::SendRequest() -{ - char type; - nsCAutoString request; // used to build request data - - nsresult rv = ParseTypeAndSelector(type, request); - if (NS_FAILED(rv)) - return rv; - - // So, we use the selector as is unless it is a search url - if (type == '7') { - // Note that we don't use the "standard" nsIURL parsing stuff here - // because the only special character is ?, and its possible to search - // for a string containing a #, and so on - - // XXX - should this find the last or first entry? - // '?' is valid in both the search string and the url - // so no matter what this does, it may be incorrect - // This only affects people codeing the query directly into the URL - PRInt32 pos = request.RFindChar('?'); - if (pos != kNotFound) { - // Just replace it with a tab - request.SetCharAt('\t', pos); - } else { - // We require a query string here - if we don't have one, - // then we need to ask the user - nsCAutoString search; - rv = PromptForQueryString(search); - if (NS_FAILED(rv)) - return rv; - - request.Append('\t'); - request.Append(search); - - // and update our uri (XXX should probably redirect instead to avoid - // confusing consumers of the channel) - nsCAutoString spec; - rv = mChannel->URI()->GetAsciiSpec(spec); - if (NS_FAILED(rv)) - return rv; - - spec.Append('?'); - spec.Append(search); - rv = mChannel->URI()->SetSpec(spec); - if (NS_FAILED(rv)) - return rv; - } - } - - request.Append(CRLF); - - PRUint32 n; - rv = mSocketOutput->Write(request.get(), request.Length(), &n); - if (NS_FAILED(rv)) - return rv; - NS_ENSURE_STATE(n == request.Length()); - - // Now, push stream converters appropriately based on our 'type' - if (type == '1' || type == '7') { - rv = mChannel->PushStreamConverter("text/gopher-dir", - APPLICATION_HTTP_INDEX_FORMAT); - if (NS_FAILED(rv)) - return rv; - } else if (type == '0') { - nsCOMPtr<nsIStreamListener> converter; - rv = mChannel->PushStreamConverter(TEXT_PLAIN, TEXT_HTML, PR_TRUE, - getter_AddRefs(converter)); - if (NS_FAILED(rv)) - return rv; - nsCOMPtr<nsITXTToHTMLConv> config = do_QueryInterface(converter); - if (config) { - nsCAutoString spec; - mChannel->URI()->GetSpec(spec); - config->SetTitle(NS_ConvertUTF8toUTF16(spec).get()); - config->PreFormatHTML(PR_TRUE); - } - } - - UpdateContentType(type); - return NS_OK; -} - -//----------------------------------------------------------------------------- - -NS_IMPL_ISUPPORTS_INHERITED1(nsGopherChannel, - nsBaseChannel, - nsIProxiedChannel) - -NS_IMETHODIMP -nsGopherChannel::GetProxyInfo(nsIProxyInfo** aProxyInfo) -{ - *aProxyInfo = ProxyInfo(); - NS_IF_ADDREF(*aProxyInfo); - return NS_OK; -} - -nsresult -nsGopherChannel::OpenContentStream(PRBool async, nsIInputStream **result, - nsIChannel** channel) -{ - // Implement nsIChannel::Open in terms of nsIChannel::AsyncOpen - if (!async) - return NS_ERROR_NOT_IMPLEMENTED; - - nsRefPtr<nsIInputStream> stream = new nsGopherContentStream(this); - if (!stream) - return NS_ERROR_OUT_OF_MEMORY; - - *result = nsnull; - stream.swap(*result); - return NS_OK; -} - -PRBool -nsGopherChannel::GetStatusArg(nsresult status, nsString &statusArg) -{ - nsCAutoString host; - URI()->GetHost(host); - CopyUTF8toUTF16(host, statusArg); - return PR_TRUE; -}
deleted file mode 100644 --- a/netwerk/protocol/gopher/nsGopherChannel.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** 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 the Gopher protocol code. - * - * The Initial Developer of the Original Code is - * Bradley Baetz. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Bradley Baetz <bbaetz@student.usyd.edu.au> - * Darin Fisher <darin@netscape.com> - * - * 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 nsGopherChannel_h__ -#define nsGopherChannel_h__ - -#include "nsBaseChannel.h" -#include "nsIProxyInfo.h" -#include "nsIProxiedChannel.h" - -class nsGopherChannel : public nsBaseChannel, public nsIProxiedChannel { -public: - nsGopherChannel(nsIURI *uri, nsIProxyInfo *pi) : mProxyInfo(pi) { - SetURI(uri); - } - - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIPROXIEDCHANNEL - - nsIProxyInfo *ProxyInfo() { return mProxyInfo; } - -protected: - virtual ~nsGopherChannel() {} - - virtual nsresult OpenContentStream(PRBool async, nsIInputStream **result, - nsIChannel** channel); - virtual PRBool GetStatusArg(nsresult status, nsString &statusArg); - -private: - nsresult SendRequest(nsIOutputStream *stream); - - nsCOMPtr<nsIProxyInfo> mProxyInfo; -}; - -#endif // !nsGopherChannel_h__
deleted file mode 100644 --- a/netwerk/protocol/gopher/nsGopherHandler.cpp +++ /dev/null @@ -1,159 +0,0 @@ - -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** 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 the Gopher protocol code. - * - * The Initial Developer of the Original Code is - * Bradley Baetz. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Bradley Baetz <bbaetz@student.usyd.edu.au> - * Darin Fisher <darin@meer.net> - * - * 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 ***** */ - -#include "nsGopherChannel.h" -#include "nsGopherHandler.h" -#include "nsIURL.h" -#include "nsIComponentManager.h" -#include "nsIServiceManager.h" -#include "nsIStandardURL.h" -#include "nsStandardURL.h" -#include "nsIPrefService.h" -#include "nsIPrefBranch2.h" - -//----------------------------------------------------------------------------- - -NS_IMPL_THREADSAFE_ISUPPORTS2(nsGopherHandler, - nsIProxiedProtocolHandler, - nsIProtocolHandler) - -//----------------------------------------------------------------------------- - -nsGopherHandler *gGopherHandler = nsnull; - -nsGopherHandler::nsGopherHandler() -{ - gGopherHandler = this; -} - -nsGopherHandler::~nsGopherHandler() -{ - gGopherHandler = nsnull; -} - -PRUint8 -nsGopherHandler::GetQoSBits() -{ - nsresult rv; - nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) { - PRInt32 val; - rv = branch->GetIntPref("network.gopher.qos", &val); - if (NS_SUCCEEDED(rv)) - return NS_CLAMP(val, 0, 0xff); - } - return 0x00; -} - -NS_IMETHODIMP -nsGopherHandler::GetScheme(nsACString &result) -{ - result.AssignLiteral("gopher"); - return NS_OK; -} - -NS_IMETHODIMP -nsGopherHandler::GetDefaultPort(PRInt32 *result) -{ - *result = GOPHER_PORT; - return NS_OK; -} - -NS_IMETHODIMP -nsGopherHandler::GetProtocolFlags(PRUint32 *result) -{ - *result = URI_NORELATIVE | ALLOWS_PROXY | ALLOWS_PROXY_HTTP | - URI_LOADABLE_BY_ANYONE; - return NS_OK; -} - -NS_IMETHODIMP -nsGopherHandler::NewURI(const nsACString &spec, const char *originCharset, - nsIURI *baseURI, nsIURI **result) -{ - nsStandardURL *url = new nsStandardURL(); - if (!url) - return NS_ERROR_OUT_OF_MEMORY; - NS_ADDREF(url); - - nsresult rv = url->Init(nsIStandardURL::URLTYPE_STANDARD, GOPHER_PORT, - spec, originCharset, baseURI); - if (NS_FAILED(rv)) { - NS_RELEASE(url); - return rv; - } - - *result = url; // no QI needed - return NS_OK; -} - -NS_IMETHODIMP -nsGopherHandler::NewProxiedChannel(nsIURI *uri, nsIProxyInfo *proxyInfo, - nsIChannel **result) -{ - NS_ENSURE_ARG_POINTER(uri); - nsGopherChannel *chan = new nsGopherChannel(uri, proxyInfo); - if (!chan) - return NS_ERROR_OUT_OF_MEMORY; - NS_ADDREF(chan); - - nsresult rv = chan->Init(); - if (NS_FAILED(rv)) { - NS_RELEASE(chan); - return rv; - } - - *result = chan; - return NS_OK; -} - -NS_IMETHODIMP -nsGopherHandler::NewChannel(nsIURI *uri, nsIChannel **result) -{ - return NewProxiedChannel(uri, nsnull, result); -} - -NS_IMETHODIMP -nsGopherHandler::AllowPort(PRInt32 port, const char *scheme, PRBool *result) -{ - *result = (port == GOPHER_PORT); - return NS_OK; -}
deleted file mode 100644 --- a/netwerk/protocol/gopher/nsGopherHandler.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** 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 the Gopher protocol code. - * - * The Initial Developer of the Original Code is - * Bradley Baetz. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Bradley Baetz <bbaetz@student.usyd.edu.au> - * - * 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 nsGopherHandler_h___ -#define nsGopherHandler_h___ - -#include "nsIProxiedProtocolHandler.h" -#include "nsIProtocolProxyService.h" -#include "nsString.h" -#include "nsCOMPtr.h" - -#define GOPHER_PORT 70 - -// {0x44588c1f-2ce8-4ad8-9b16-dfb9d9d513a7} - -#define NS_GOPHERHANDLER_CID \ -{ 0x44588c1f, 0x2ce8, 0x4ad8, \ - {0x9b, 0x16, 0xdf, 0xb9, 0xd9, 0xd5, 0x13, 0xa7} } - -class nsGopherHandler : public nsIProxiedProtocolHandler -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPROTOCOLHANDLER - NS_DECL_NSIPROXIEDPROTOCOLHANDLER - - // nsGopherHandler methods: - nsGopherHandler(); - virtual ~nsGopherHandler(); - - PRUint8 GetQoSBits(); - -protected: - nsCOMPtr<nsIProtocolProxyService> mProxySvc; -}; - -extern nsGopherHandler *gGopherHandler; - -#endif /* nsGopherHandler_h___ */
--- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -4615,17 +4615,16 @@ nsHttpChannel::SetReferrer(nsIURI *refer // // block referrer if not on our white list... // static const char *const referrerWhiteList[] = { "http", "https", "ftp", - "gopher", nsnull }; match = PR_FALSE; const char *const *scheme = referrerWhiteList; for (; *scheme && !match; ++scheme) { rv = referrer->SchemeIs(*scheme, &match); if (NS_FAILED(rv)) return rv; }
--- a/netwerk/streamconv/converters/Makefile.in +++ b/netwerk/streamconv/converters/Makefile.in @@ -62,24 +62,16 @@ CPPSRCS = \ # protocol is being built. ifneq (,$(filter ftp,$(NECKO_PROTOCOLS))) CPPSRCS += \ ParseFTPList.cpp \ nsFTPDirListingConv.cpp \ $(NULL) endif -# only include Gopher directory listing support if the Gopher -# protocol is being built. -ifneq (,$(filter gopher,$(NECKO_PROTOCOLS))) -CPPSRCS += \ - nsGopherDirListingConv.cpp \ - $(NULL) -endif - ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT)) CPPSRCS += \ nsBinHexDecoder.cpp \ $(NULL) endif # we don't want the shared lib, but we want to force the creation of a # static lib.
deleted file mode 100644 --- a/netwerk/streamconv/converters/nsGopherDirListingConv.cpp +++ /dev/null @@ -1,350 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** 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 the gopher-directory to http-index code. - * - * The Initial Developer of the Original Code is - * Bradley Baetz. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Bradley Baetz <bbaetz@student.usyd.edu.au> - * - * 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 ***** */ - -/* This code is based on the ftp directory translation code */ - -#include "plstr.h" -#include "nsMemory.h" -#include "nsCRT.h" -#include "nsIServiceManager.h" -#include "nsIGenericFactory.h" -#include "nsString.h" -#include "nsReadableUtils.h" -#include "nsCOMPtr.h" -#include "nsIURI.h" -#include "nsEscape.h" -#include "nsIStreamListener.h" -#include "nsIStreamConverter.h" -#include "nsStringStream.h" -#include "nsIRequestObserver.h" -#include "nsNetUtil.h" -#include "nsMimeTypes.h" - -#include "nsGopherDirListingConv.h" - -// nsISupports implementation -NS_IMPL_ISUPPORTS3(nsGopherDirListingConv, - nsIStreamConverter, - nsIStreamListener, - nsIRequestObserver) - -// nsIStreamConverter implementation - -#define CONV_BUF_SIZE (4*1024) - -NS_IMETHODIMP -nsGopherDirListingConv::Convert(nsIInputStream *aFromStream, - const char *aFromType, - const char *aToType, - nsISupports *aCtxt, nsIInputStream **_retval) { - return NS_ERROR_NOT_IMPLEMENTED; -} - -// Stream converter service calls this to initialize the actual -// stream converter (us). -NS_IMETHODIMP -nsGopherDirListingConv::AsyncConvertData(const char *aFromType, - const char *aToType, - nsIStreamListener *aListener, - nsISupports *aCtxt) { - NS_ASSERTION(aListener && aFromType && aToType, - "null pointer passed into gopher dir listing converter"); - - // hook up our final listener. this guy gets the various On*() calls - // we want to throw at him. - mFinalListener = aListener; - - return NS_OK; -} - -// nsIStreamListener implementation -NS_IMETHODIMP -nsGopherDirListingConv::OnDataAvailable(nsIRequest *request, - nsISupports *ctxt, - nsIInputStream *inStr, - PRUint32 sourceOffset, - PRUint32 count) { - nsresult rv; - - PRUint32 read, streamLen; - nsCAutoString indexFormat; - - rv = inStr->Available(&streamLen); - if (NS_FAILED(rv)) return rv; - - char *buffer = (char*)nsMemory::Alloc(streamLen + 1); - if (!buffer) - return NS_ERROR_OUT_OF_MEMORY; - rv = inStr->Read(buffer, streamLen, &read); - if (NS_FAILED(rv)) - return rv; - - // the dir listings are ascii text, null terminate this sucker. - buffer[streamLen] = '\0'; - - if (!mBuffer.IsEmpty()) { - // we have data left over from a previous OnDataAvailable() call. - // combine the buffers so we don't lose any data. - mBuffer.Append(buffer); - nsMemory::Free(buffer); - buffer = ToNewCString(mBuffer); - mBuffer.Truncate(); - } - - if (!mSentHeading) { - nsCOMPtr<nsIChannel> channel = do_QueryInterface(request); - NS_ENSURE_STATE(channel); - - nsCOMPtr<nsIURI> uri; - channel->GetURI(getter_AddRefs(uri)); - NS_ENSURE_STATE(uri); - - // build up the 300: line - nsCAutoString spec; - rv = uri->GetAsciiSpec(spec); - if (NS_FAILED(rv)) - return rv; - - //printf("spec is %s\n",spec.get()); - - indexFormat.AppendLiteral("300: "); - indexFormat.Append(spec); - indexFormat.Append(char(nsCRT::LF)); - // END 300: - - // build up the column heading; 200: - indexFormat.AppendLiteral("200: description filename file-type\n"); - // END 200: - - mSentHeading = PR_TRUE; - } - char *line = DigestBufferLines(buffer, indexFormat); - // if there's any data left over, buffer it. - if (line && *line) { - mBuffer.Append(line); - } - - nsMemory::Free(buffer); - - // send the converted data out. - nsCOMPtr<nsIInputStream> inputData; - - rv = NS_NewCStringInputStream(getter_AddRefs(inputData), indexFormat); - if (NS_FAILED(rv)) - return rv; - - rv = mFinalListener->OnDataAvailable(request, ctxt, inputData, 0, - indexFormat.Length()); - return rv; -} - -// nsIRequestObserver implementation -NS_IMETHODIMP -nsGopherDirListingConv::OnStartRequest(nsIRequest *request, nsISupports *ctxt) { - // we don't care about start. move along... but start masqeurading - // as the http-index channel now. - return mFinalListener->OnStartRequest(request, ctxt); -} - -NS_IMETHODIMP -nsGopherDirListingConv::OnStopRequest(nsIRequest *request, nsISupports *ctxt, - nsresult aStatus) { - return mFinalListener->OnStopRequest(request, ctxt, aStatus); -} - -// nsGopherDirListingConv methods -nsGopherDirListingConv::nsGopherDirListingConv() { - mSentHeading = PR_FALSE; -} - -char* -nsGopherDirListingConv::DigestBufferLines(char* aBuffer, nsCAutoString& aString) { - char *line = aBuffer; - char *eol; - PRBool cr = PR_FALSE; - - // while we have new lines, parse 'em into application/http-index-format. - while (line && (eol = PL_strchr(line, nsCRT::LF)) ) { - // yank any carriage returns too. - if (eol > line && *(eol-1) == nsCRT::CR) { - eol--; - *eol = '\0'; - cr = PR_TRUE; - } else { - *eol = '\0'; - cr = PR_FALSE; - } - - if (line[0]=='.' && line[1]=='\0') { - if (cr) - line = eol+2; - else - line = eol+1; - continue; - } - - char type; - nsCAutoString desc, selector, host; - PRInt32 port = GOPHER_PORT; - - type = line[0]; - line++; - char* tabPos = PL_strchr(line,'\t'); - - /* Get the description */ - if (tabPos) { - /* if the description is not empty */ - if (tabPos != line) { - char* descStr = PL_strndup(line,tabPos-line); - if (!descStr) - return nsnull; - char* escName = nsEscape(descStr,url_Path); - if (!escName) { - PL_strfree(descStr); - return nsnull; - } - desc = escName; - NS_Free(escName); - PL_strfree(descStr); - } else { - desc = "%20"; - } - line = tabPos+1; - tabPos = PL_strchr(line,'\t'); - } - - /* Get selector */ - if (tabPos) { - char* sel = PL_strndup(line,tabPos-line); - if (!sel) - return nsnull; - char* escName = nsEscape(sel,url_Path); - if (!escName) { - PL_strfree(sel); - return nsnull; - } - selector = escName; - NS_Free(escName); - PL_strfree(sel); - line = tabPos+1; - tabPos = PL_strchr(line,'\t'); - } - - /* Host and Port - put together because there is - no tab after the port */ - if (tabPos) { - host.Assign(line, tabPos - line); - line = tabPos+1; - tabPos = PL_strchr(line,'\t'); - if (tabPos == NULL) - tabPos = PL_strchr(line,'\0'); - - /* Port */ - nsCAutoString portStr(line, tabPos - line); - port = atol(portStr.get()); - line = tabPos+1; - } - - // Now create the url - nsCAutoString filename; - if (type != '8' && type != 'T') { - filename.AssignLiteral("gopher://"); - filename.Append(host); - if (port != GOPHER_PORT) { - filename.Append(':'); - filename.AppendInt(port); - } - filename.Append('/'); - filename.Append(type); - filename.Append(selector); - } else { - // construct telnet/tn3270 url. - // Moz doesn't support these, so this is UNTESTED!!!!! - // (I do get the correct error message though) - if (type == '8') - // telnet - filename.AssignLiteral("telnet://"); - else - // tn3270 - filename.AssignLiteral("tn3270://"); - if (!selector.IsEmpty()) { - filename.Append(selector); - filename.Append('@'); - } - filename.Append(host); - if (port != 23) { // telnet port - filename.Append(':'); - filename.AppendInt(port); - } - } - - if (tabPos) { - /* Don't display error messages or informative messages - because they could be selected, and they'll be sorted - out of order. - If FTP displays .messages/READMEs ever, then I could use the - same method to display these - */ - if (type != '3' && type != 'i') { - aString.AppendLiteral("201: "); - aString.Append(desc); - aString.Append(' '); - aString.Append(filename); - aString.Append(' '); - if (type == '1') - aString.AppendLiteral("DIRECTORY"); - else - aString.AppendLiteral("FILE"); - aString.Append(char(nsCRT::LF)); - } else if(type == 'i'){ - aString.AppendLiteral("101: "); - aString.Append(desc); - aString.Append(char(nsCRT::LF)); - } - } else { - NS_WARNING("Error parsing gopher directory response.\n"); - } - - if (cr) - line = eol+2; - else - line = eol+1; - } - return line; -}
deleted file mode 100644 --- a/netwerk/streamconv/converters/nsGopherDirListingConv.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** 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 the gopher-directory to http-index code. - * - * The Initial Developer of the Original Code is - * Bradley Baetz. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Bradley Baetz <bbaetz@student.usyd.edu.au> - * - * 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 ***** */ - -/* This code is heavily based on nsFTPDirListingConv.{cpp,h} */ - -#ifndef __nsgopherdirlistingconv__h__ -#define __nsgopherdirlistingconv__h__ - -#include "nspr.h" -#include "prtypes.h" -#include "nsIStreamConverter.h" -#include "nsIChannel.h" -#include "nsString.h" -#include "nsIChannel.h" -#include "nsCOMPtr.h" -#include "nsIURI.h" - -#include "nsIFactory.h" - -#define NS_GOPHERDIRLISTINGCONVERTER_CID \ - { /* ea617873-3b73-4efd-a2c4-fc39bfab809d */ \ - 0xea617873, \ - 0x3b73, \ - 0x4efd, \ - { 0xa2, 0xc4, 0xfc, 0x39, 0xbf, 0xab, 0x80, 0x9d} \ -} - -#define GOPHER_PORT 70 - -class nsGopherDirListingConv : public nsIStreamConverter { -public: - NS_DECL_ISUPPORTS - NS_DECL_NSISTREAMCONVERTER - NS_DECL_NSISTREAMLISTENER - NS_DECL_NSIREQUESTOBSERVER - - nsGopherDirListingConv(); - -private: - char* DigestBufferLines(char *aBuffer, nsCAutoString& aString); - - nsCString mBuffer; // buffered data. - PRBool mSentHeading; - nsCOMPtr<nsIStreamListener> mFinalListener; // this guy gets the converted data via his OnDataAvailable() -}; - -#endif /* __nsgopherdirlistingdconv__h__ */
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp +++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp @@ -180,17 +180,16 @@ nsIndexedToHTML::OnStartRequest(nsIReque // buffer, and do other painful stuff. // I'll deal with this when I make the changes to handle welcome messages // The .. stuff should also come from the lower level protocols, but that // would muck up the XUL display // - bbaetz PRBool isScheme = PR_FALSE; PRBool isSchemeFile = PR_FALSE; - PRBool isSchemeGopher = PR_FALSE; if (NS_SUCCEEDED(uri->SchemeIs("ftp", &isScheme)) && isScheme) { // strip out the password here, so it doesn't show in the page title // This is done by the 300: line generation in ftp, but we don't use // that - see above nsCAutoString pw; rv = uri->GetPassword(pw); @@ -235,18 +234,16 @@ nsIndexedToHTML::OnStartRequest(nsIReque if (NS_FAILED(rv)) return rv; parentStr.Assign(url); } // Directory index will be always encoded in UTF-8 if this is file url rv = mParser->SetEncoding("UTF-8"); NS_ENSURE_SUCCESS(rv, rv); - } else if (NS_SUCCEEDED(uri->SchemeIs("gopher", &isSchemeGopher)) && isSchemeGopher) { - mExpectAbsLoc = PR_TRUE; } else if (NS_SUCCEEDED(uri->SchemeIs("jar", &isScheme)) && isScheme) { nsCAutoString path; rv = uri->GetPath(path); if (NS_FAILED(rv)) return rv; // a top-level jar directory URL is of the form jar:foo.zip!/ // path will be of the form foo.zip!/, and its last two characters // will be "!/" @@ -358,25 +355,16 @@ nsIndexedToHTML::OnStartRequest(nsIReque " -moz-padding-end: .5em;\n" " white-space: nowrap;\n" "}\n" "/* time */\n" "td:last-child {\n" " -moz-padding-start: .5em;\n" " white-space: nowrap;\n" "}\n" - "@-moz-document url-prefix(gopher://) {\n" - " td {\n" - " white-space: pre !important;\n" - " font-family: monospace;\n" - " }\n" - " table {\n" - " direction: ltr;\n" - " }\n" - "}\n" ".symlink {\n" " font-style: italic;\n" "}\n" ".dir ,\n" ".symlink ,\n" ".file {\n" " -moz-margin-start: 20px;\n" "}\n" @@ -386,99 +374,97 @@ nsIndexedToHTML::OnStartRequest(nsIReque " -moz-margin-start: -20px;\n" " vertical-align: middle;\n" "}\n" ".dir::before {\n" " content: url(resource://gre/res/html/folder.png);\n" "}\n" "]]></style>\n" "<link rel=\"stylesheet\" media=\"screen, projection\" type=\"text/css\"" - " href=\"chrome://global/skin/dirListing/dirListing.css\" />\n"); + " href=\"chrome://global/skin/dirListing/dirListing.css\" />\n" + "<script type=\"application/javascript\"><![CDATA[\n" + "var gTable, gOrderBy, gTBody, gRows, gUI_showHidden;\n" + "document.addEventListener(\"DOMContentLoaded\", function() {\n" + " gTable = document.getElementsByTagName(\"table\")[0];\n" + " gTBody = gTable.tBodies[0];\n" + " if (gTBody.rows.length < 2)\n" + " return;\n" + " gUI_showHidden = document.getElementById(\"UI_showHidden\");\n" + " var headCells = gTable.tHead.rows[0].cells,\n" + " hiddenObjects = false;\n" + " function rowAction(i) {\n" + " return function(event) {\n" + " event.preventDefault();\n" + " orderBy(i);\n" + " }\n" + " }\n" + " for (var i = headCells.length - 1; i >= 0; i--) {\n" + " var anchor = document.createElement(\"a\");\n" + " anchor.href = \"\";\n" + " anchor.appendChild(headCells[i].firstChild);\n" + " headCells[i].appendChild(anchor);\n" + " headCells[i].addEventListener(\"click\", rowAction(i), true);\n" + " }\n" + " if (gUI_showHidden) {\n" + " gRows = Array.slice(gTBody.rows);\n" + " hiddenObjects = gRows.some(function (row) row.className == \"hidden-object\");\n" + " }\n" + " gTable.setAttribute(\"order\", \"\");\n" + " if (hiddenObjects) {\n" + " gUI_showHidden.style.display = \"block\";\n" + " updateHidden();\n" + " }\n" + "}, \"false\");\n" + "function compareRows(rowA, rowB) {\n" + " var a = rowA.cells[gOrderBy].getAttribute(\"sortable-data\") || \"\";\n" + " var b = rowB.cells[gOrderBy].getAttribute(\"sortable-data\") || \"\";\n" + " var intA = +a;\n" + " var intB = +b;\n" + " if (a == intA && b == intB) {\n" + " a = intA;\n" + " b = intB;\n" + " } else {\n" + " a = a.toLowerCase();\n" + " b = b.toLowerCase();\n" + " }\n" + " if (a < b)\n" + " return -1;\n" + " if (a > b)\n" + " return 1;\n" + " return 0;\n" + "}\n" + "function orderBy(column) {\n" + " if (!gRows)\n" + " gRows = Array.slice(gTBody.rows);\n" + " var order;\n" + " if (gOrderBy == column) {\n" + " order = gTable.getAttribute(\"order\") == \"asc\" ? \"desc\" : \"asc\";\n" + " } else {\n" + " order = \"asc\";\n" + " gOrderBy = column;\n" + " gTable.setAttribute(\"order-by\", column);\n" + " gRows.sort(compareRows);\n" + " }\n" + " gTable.removeChild(gTBody);\n" + " gTable.setAttribute(\"order\", order);\n" + " if (order == \"asc\")\n" + " for (var i = 0; i < gRows.length; i++)\n" + " gTBody.appendChild(gRows[i]);\n" + " else\n" + " for (var i = gRows.length - 1; i >= 0; i--)\n" + " gTBody.appendChild(gRows[i]);\n" + " gTable.appendChild(gTBody);\n" + "}\n" + "function updateHidden() {\n" + " gTable.className = gUI_showHidden.getElementsByTagName(\"input\")[0].checked ?\n" + " \"\" :\n" + " \"remove-hidden\";\n" + "}\n" + "]]></script>\n"); - if (!isSchemeGopher) { - buffer.AppendLiteral("<script type=\"application/javascript\"><![CDATA[\n" - "var gTable, gOrderBy, gTBody, gRows, gUI_showHidden;\n" - "document.addEventListener(\"DOMContentLoaded\", function() {\n" - " gTable = document.getElementsByTagName(\"table\")[0];\n" - " gTBody = gTable.tBodies[0];\n" - " if (gTBody.rows.length < 2)\n" - " return;\n" - " gUI_showHidden = document.getElementById(\"UI_showHidden\");\n" - " var headCells = gTable.tHead.rows[0].cells,\n" - " hiddenObjects = false;\n" - " function rowAction(i) {\n" - " return function(event) {\n" - " event.preventDefault();\n" - " orderBy(i);\n" - " }\n" - " }\n" - " for (var i = headCells.length - 1; i >= 0; i--) {\n" - " var anchor = document.createElement(\"a\");\n" - " anchor.href = \"\";\n" - " anchor.appendChild(headCells[i].firstChild);\n" - " headCells[i].appendChild(anchor);\n" - " headCells[i].addEventListener(\"click\", rowAction(i), true);\n" - " }\n" - " if (gUI_showHidden) {\n" - " gRows = Array.slice(gTBody.rows);\n" - " hiddenObjects = gRows.some(function (row) row.className == \"hidden-object\");\n" - " }\n" - " gTable.setAttribute(\"order\", \"\");\n" - " if (hiddenObjects) {\n" - " gUI_showHidden.style.display = \"block\";\n" - " updateHidden();\n" - " }\n" - "}, \"false\");\n" - "function compareRows(rowA, rowB) {\n" - " var a = rowA.cells[gOrderBy].getAttribute(\"sortable-data\") || \"\";\n" - " var b = rowB.cells[gOrderBy].getAttribute(\"sortable-data\") || \"\";\n" - " var intA = +a;\n" - " var intB = +b;\n" - " if (a == intA && b == intB) {\n" - " a = intA;\n" - " b = intB;\n" - " } else {\n" - " a = a.toLowerCase();\n" - " b = b.toLowerCase();\n" - " }\n" - " if (a < b)\n" - " return -1;\n" - " if (a > b)\n" - " return 1;\n" - " return 0;\n" - "}\n" - "function orderBy(column) {\n" - " if (!gRows)\n" - " gRows = Array.slice(gTBody.rows);\n" - " var order;\n" - " if (gOrderBy == column) {\n" - " order = gTable.getAttribute(\"order\") == \"asc\" ? \"desc\" : \"asc\";\n" - " } else {\n" - " order = \"asc\";\n" - " gOrderBy = column;\n" - " gTable.setAttribute(\"order-by\", column);\n" - " gRows.sort(compareRows);\n" - " }\n" - " gTable.removeChild(gTBody);\n" - " gTable.setAttribute(\"order\", order);\n" - " if (order == \"asc\")\n" - " for (var i = 0; i < gRows.length; i++)\n" - " gTBody.appendChild(gRows[i]);\n" - " else\n" - " for (var i = gRows.length - 1; i >= 0; i--)\n" - " gTBody.appendChild(gRows[i]);\n" - " gTable.appendChild(gTBody);\n" - "}\n" - "function updateHidden() {\n" - " gTable.className = gUI_showHidden.getElementsByTagName(\"input\")[0].checked ?\n" - " \"\" :\n" - " \"remove-hidden\";\n" - "}\n" - "]]></script>\n"); - } buffer.AppendLiteral("<link rel=\"icon\" type=\"image/png\" href=\""); nsCOMPtr<nsIURI> innerUri = NS_GetInnermostURI(uri); if (!innerUri) return NS_ERROR_UNEXPECTED; nsCOMPtr<nsIFileURL> fileURL(do_QueryInterface(innerUri)); //XXX bug 388553: can't use skinnable icons here due to security restrictions if (fileURL) { //buffer.AppendLiteral("chrome://global/skin/dirListing/local.png"); @@ -520,17 +506,17 @@ nsIndexedToHTML::OnStartRequest(nsIReque "L%2FT6P0ewqPx5nmiAG5f6AoCtN1PbJzuRyJAyDBzzSQYvEr" "f06yYxhGXlEa8H2KVGoasjwLx3Ewk858opQWXm%2B%2Fib9E" "QrBzclLLLy89xYvlpchvtixcX6uo1y%2FzsiwHrkIsgKbp%2" "BYWFOWicuqppoNTnStHzPFCPQhBEBOyGAX4JMADFetubi4BS" "YAAAAABJRU5ErkJggg%3D%3D"); } buffer.AppendLiteral("\" />\n<title>"); - // Anything but a gopher url needs to end in a /, + // Everything needs to end in a /, // otherwise we end up linking to file:///foo/dirfile if (!mTextToSubURI) { mTextToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; } nsXPIDLString unEscapeSpec; @@ -639,45 +625,43 @@ nsIndexedToHTML::OnStartRequest(nsIReque buffer.AppendLiteral("<p id=\"UI_showHidden\" style=\"display:none\"><label><input type=\"checkbox\" checked=\"checked\" onchange=\"updateHidden()\" />"); AppendNonAsciiToNCR(showHiddenText, buffer); buffer.AppendLiteral("</label></p>\n"); } buffer.AppendLiteral("<table>\n"); - if (!isSchemeGopher) { - nsXPIDLString columnText; + nsXPIDLString columnText; - buffer.AppendLiteral(" <thead>\n" - " <tr>\n" - " <th>"); + buffer.AppendLiteral(" <thead>\n" + " <tr>\n" + " <th>"); - rv = mBundle->GetStringFromName(NS_LITERAL_STRING("DirColName").get(), - getter_Copies(columnText)); - if (NS_FAILED(rv)) return rv; - AppendNonAsciiToNCR(columnText, buffer); - buffer.AppendLiteral("</th>\n" - " <th>"); + rv = mBundle->GetStringFromName(NS_LITERAL_STRING("DirColName").get(), + getter_Copies(columnText)); + if (NS_FAILED(rv)) return rv; + AppendNonAsciiToNCR(columnText, buffer); + buffer.AppendLiteral("</th>\n" + " <th>"); - rv = mBundle->GetStringFromName(NS_LITERAL_STRING("DirColSize").get(), - getter_Copies(columnText)); - if (NS_FAILED(rv)) return rv; - AppendNonAsciiToNCR(columnText, buffer); - buffer.AppendLiteral("</th>\n" - " <th colspan=\"2\">"); + rv = mBundle->GetStringFromName(NS_LITERAL_STRING("DirColSize").get(), + getter_Copies(columnText)); + if (NS_FAILED(rv)) return rv; + AppendNonAsciiToNCR(columnText, buffer); + buffer.AppendLiteral("</th>\n" + " <th colspan=\"2\">"); - rv = mBundle->GetStringFromName(NS_LITERAL_STRING("DirColMTime").get(), - getter_Copies(columnText)); - if (NS_FAILED(rv)) return rv; - AppendNonAsciiToNCR(columnText, buffer); - buffer.AppendLiteral("</th>\n" - " </tr>\n" - " </thead>\n"); - } + rv = mBundle->GetStringFromName(NS_LITERAL_STRING("DirColMTime").get(), + getter_Copies(columnText)); + if (NS_FAILED(rv)) return rv; + AppendNonAsciiToNCR(columnText, buffer); + buffer.AppendLiteral("</th>\n" + " </tr>\n" + " </thead>\n"); buffer.AppendLiteral(" <tbody>\n"); // Push buffer to the listener now, so the initial HTML will not // be parsed in OnDataAvailable(). rv = mListener->OnStartRequest(request, aContext); if (NS_FAILED(rv)) return rv; @@ -840,42 +824,38 @@ nsIndexedToHTML::OnIndexAvailable(nsIReq //XXX this should be left to the stylesheet (bug 391471) nsString escapedShort; if (description.Length() > 71) { nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest); nsCOMPtr<nsIURI> uri; rv = channel->GetURI(getter_AddRefs(uri)); if (NS_FAILED(rv)) return rv; - // No need to do this for Gopher, as the table has only one column in that case - PRBool isSchemeGopher = PR_FALSE; - if (!(NS_SUCCEEDED(uri->SchemeIs("gopher", &isSchemeGopher)) && isSchemeGopher)) { - //XXX this potentially truncates after a combining char (bug 391472) - nsXPIDLString descriptionAffix; - descriptionAffix.Assign(description); - descriptionAffix.Cut(0, descriptionAffix.Length() - 25); - if (NS_IS_LOW_SURROGATE(descriptionAffix.First())) - descriptionAffix.Cut(0, 1); - description.Truncate(PR_MIN(71, description.Length() - 28)); - if (NS_IS_HIGH_SURROGATE(description.Last())) - description.Truncate(description.Length() - 1); + //XXX this potentially truncates after a combining char (bug 391472) + nsXPIDLString descriptionAffix; + descriptionAffix.Assign(description); + descriptionAffix.Cut(0, descriptionAffix.Length() - 25); + if (NS_IS_LOW_SURROGATE(descriptionAffix.First())) + descriptionAffix.Cut(0, 1); + description.Truncate(PR_MIN(71, description.Length() - 28)); + if (NS_IS_HIGH_SURROGATE(description.Last())) + description.Truncate(description.Length() - 1); - escapedShort.Adopt(nsEscapeHTML2(description.get(), description.Length())); + escapedShort.Adopt(nsEscapeHTML2(description.get(), description.Length())); - escapedShort.Append(mEscapedEllipsis); - // add ZERO WIDTH SPACE (U+200B) for wrapping - escapedShort.AppendLiteral("​"); - nsString tmp; - tmp.Adopt(nsEscapeHTML2(descriptionAffix.get(), descriptionAffix.Length())); - escapedShort.Append(tmp); + escapedShort.Append(mEscapedEllipsis); + // add ZERO WIDTH SPACE (U+200B) for wrapping + escapedShort.AppendLiteral("​"); + nsString tmp; + tmp.Adopt(nsEscapeHTML2(descriptionAffix.get(), descriptionAffix.Length())); + escapedShort.Append(tmp); - pushBuffer.AppendLiteral(" title=\""); - pushBuffer.Append(escaped); - pushBuffer.AppendLiteral("\""); - } + pushBuffer.AppendLiteral(" title=\""); + pushBuffer.Append(escaped); + pushBuffer.AppendLiteral("\""); } if (escapedShort.IsEmpty()) escapedShort.Assign(escaped); nsMemory::Free(escaped); pushBuffer.AppendLiteral(" href=\""); nsXPIDLCString loc; aIndex->GetLocation(getter_Copies(loc)); @@ -903,17 +883,17 @@ nsIndexedToHTML::OnIndexAvailable(nsIReq // or a directory (bug #214405). if ((type == nsIDirIndex::TYPE_DIRECTORY) && (utf8UnEscapeSpec.Last() != '/')) { utf8UnEscapeSpec.Append('/'); } // now minimally re-escape the location... PRUint32 escFlags; - // for some protocols, like gopher, we expect the location to be absolute. + // for some protocols, we expect the location to be absolute. // if so, and if the location indeed appears to be a valid URI, then go // ahead and treat it like one. if (mExpectAbsLoc && NS_SUCCEEDED(net_ExtractURLScheme(utf8UnEscapeSpec, nsnull, nsnull, nsnull))) { // escape as absolute escFlags = esc_Forced | esc_OnlyASCII | esc_AlwaysCopy | esc_Minimal; } else {
--- a/toolkit/toolkit-makefiles.sh +++ b/toolkit/toolkit-makefiles.sh @@ -369,17 +369,16 @@ MAKEFILES_netwerk=" netwerk/cookie/Makefile netwerk/wifi/Makefile netwerk/dns/Makefile netwerk/protocol/Makefile netwerk/protocol/about/Makefile netwerk/protocol/data/Makefile netwerk/protocol/file/Makefile netwerk/protocol/ftp/Makefile - netwerk/protocol/gopher/Makefile netwerk/protocol/http/Makefile netwerk/protocol/res/Makefile netwerk/protocol/viewsource/Makefile netwerk/mime/Makefile netwerk/socket/Makefile netwerk/streamconv/Makefile netwerk/streamconv/converters/Makefile netwerk/streamconv/public/Makefile
--- a/xpfe/components/directory/nsDirectoryViewer.cpp +++ b/xpfe/components/directory/nsDirectoryViewer.cpp @@ -42,17 +42,17 @@ /* A directory viewer object. Parses "application/http-index-format" per Lou Montulli's original spec: http://www.mozilla.org/projects/netlib/dirindexformat.html One added change is for a description entry, for when the - target does not match the filename (ie gopher) + target does not match the filename */ #include "nsDirectoryViewer.h" #include "nsIDirIndex.h" #include "jsapi.h" #include "nsCOMPtr.h" #include "nsCRT.h" @@ -102,17 +102,16 @@ static const int FORMAT_XUL = 3; // #ifdef MOZ_RDF static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); #endif // Various protocols we have to special case static const char kFTPProtocol[] = "ftp://"; -static const char kGopherProtocol[] = "gopher://"; //---------------------------------------------------------------------- // // nsHTTPIndex // #ifdef MOZ_RDF NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsHTTPIndex) @@ -423,29 +422,22 @@ nsHTTPIndex::OnIndexAvailable(nsIRequest if (! baseStr) { NS_ERROR("Could not reconstruct base uri\n"); return NS_ERROR_UNEXPECTED; } // we found the filename; construct a resource for its entry nsCAutoString entryuriC(baseStr); - // gopher resources don't point to an entry in the same directory - // like ftp uris. So the entryuriC is just a unique string, while - // the URL attribute is the destination of this element - // The naming scheme for the attributes is taken from the bookmarks nsXPIDLCString filename; nsresult rv = aIndex->GetLocation(getter_Copies(filename)); if (NS_FAILED(rv)) return rv; entryuriC.Append(filename); // if its a directory, make sure it ends with a trailing slash. - // This doesn't matter for gopher, (where directories don't have - // to end in a trailing /), because the filename is used for the URL - // attribute. PRUint32 type; rv = aIndex->GetType(&type); if (NS_FAILED(rv)) return rv; PRBool isDirType = (type == nsIDirIndex::TYPE_DIRECTORY); if (isDirType && entryuriC.Last() != '/') { @@ -459,24 +451,17 @@ nsHTTPIndex::OnIndexAvailable(nsIRequest // constructed a resource for it, stored in entry. So now take a // second pass through the values and add as statements to the RDF // datasource. if (entry && NS_SUCCEEDED(rv)) { nsCOMPtr<nsIRDFLiteral> lit; nsString str; - // For gopher, the target is the filename. We still have to do all - // the above string manipulation though, because we need the entryuric - // as the key for the RDF data source - if (!strncmp(entryuriC.get(), kGopherProtocol, sizeof(kGopherProtocol)-1)) - str.AssignWithConversion(filename); - else { - str.AssignWithConversion(entryuriC.get()); - } + str.AssignWithConversion(entryuriC.get()); rv = mDirRDF->GetLiteral(str.get(), getter_AddRefs(lit)); if (NS_SUCCEEDED(rv)) { rv = Assert(entry, kNC_URL, lit, PR_TRUE); if (NS_FAILED(rv)) return rv; nsXPIDLString xpstr; @@ -784,17 +769,16 @@ void nsHTTPIndex::GetDestination(nsIRDFR // b) we could easily handle file:// URLs here // Q: Why don't we? // A: The file system datasource ("rdf:file"); at some point, the two // should be perhaps united. Until then, we can't aggregate both // "rdf:file" and "http-index" (such as with bookmarks) because we'd // get double the # of answers we really want... also, "rdf:file" is // less expensive in terms of both memory usage as well as speed -// We also handle gopher now // We use an rdf attribute to mark if this is a container or not. // Note that we still have to do string comparisons as a fallback // because stuff like the personal toolbar and bookmarks check whether // a URL is a container, and we have no attribute in that case. PRBool nsHTTPIndex::isWellknownContainerURI(nsIRDFResource *r) @@ -804,42 +788,23 @@ nsHTTPIndex::isWellknownContainerURI(nsI PRBool isContainerFlag = PR_FALSE; if (node && NS_SUCCEEDED(node->EqualsNode(kTrueLiteral, &isContainerFlag))) { return isContainerFlag; } else { nsXPIDLCString uri; - // For gopher, we need to follow the URL attribute to get the - // real destination GetDestination(r,uri); if ((uri.get()) && (!strncmp(uri, kFTPProtocol, sizeof(kFTPProtocol) - 1))) { if (uri.Last() == '/') { isContainerFlag = PR_TRUE; } } - - // A gopher url is of the form: - // gopher://example.com/xFileNameToGet - // where x is a single character representing the type of file - // 1 is a directory, and 7 is a search. - // Searches will cause a dialog to be popped up (asking the user what - // to search for), and so even though searches return a directory as a - // result, don't treat it as a directory here. - - // The isContainerFlag test above will correctly handle this when a - // search url is passed in as the baseuri - if ((uri.get()) && - (!strncmp(uri,kGopherProtocol, sizeof(kGopherProtocol)-1))) { - char* pos = PL_strchr(uri+sizeof(kGopherProtocol)-1, '/'); - if (!pos || pos[1] == '\0' || pos[1] == '1') - isContainerFlag = PR_TRUE; - } } return isContainerFlag; } NS_IMETHODIMP nsHTTPIndex::GetURI(char * *uri) {