Merge pull request #32 from roytam1/relex-gopher-port-restriction-pref

allow accessing non-standard port of gopher
This commit is contained in:
rn10950 2018-11-24 19:35:33 -05:00 committed by GitHub
commit 437c53a136
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View File

@ -2390,3 +2390,6 @@ pref("print.print_command", "lp -c -s ${MOZ_PRINTER_NAME:+'-d '}${MOZ_PRINTER_NA
#ifdef MOZ_X11
pref("network.gnomevfs.supported-protocols", "smb:,sftp:");
#endif
// restrict gopher port to port 70 only
pref("network.gopher.port-restricted", true);

View File

@ -122,12 +122,20 @@ nsGopherChannel::Init(nsIURI* uri, nsIProxyInfo* proxyInfo)
if (NS_FAILED(rv))
return rv;
PRBool restrictedPort = PR_TRUE;
nsCOMPtr<nsIPrefBranch> branch;
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
if (!NS_FAILED(rv)) {
branch = do_QueryInterface(prefs);
branch->GetBoolPref("network.gopher.port-restricted" , &restrictedPort);
}
// For security reasons, don't allow anything expect the default
// gopher port (70). See bug 71916 - bbaetz@cs.mcgill.ca
/*
if(!restrictedPort) {
if (mPort==-1)
mPort=GOPHER_PORT;
*/
} else
mPort=GOPHER_PORT;
// No path given

View File

@ -376,7 +376,7 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
buffer.AppendLiteral("<style type=\"text/css\">\n"
"img { border: 0; padding: 0 2px; vertical-align: text-bottom; }\n"
"td { font-family: monospace; padding: 2px 3px; text-align: right; vertical-align: bottom; white-space: pre; }\n"
"td { font-family: monospace; padding: 2px 3px; text-align: right; vertical-align: bottom; white-space: -moz-pre-wrap; }\n"
"td:first-child { text-align: left; padding: 2px 10px 2px 3px; }\n"
"table { border: 0; }\n"
"a.symlink { font-style: italic; }\n"