Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions chromium/background-scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ function onBeforeRequest(details) {
// true if the URL is a http:// connection to a remote canonical host, and not
// a tor hidden service
const shouldCancel = httpNowhereOn &&
uri.protocol === 'http:' &&
(uri.protocol === 'http:' || uri.protocol === 'ftp:') &&
uri.hostname.slice(-6) !== '.onion' &&
uri.hostname !== 'localhost' &&
!/^127(\.[0-9]{1,3}){3}$/.test(uri.hostname) &&
Expand Down Expand Up @@ -393,8 +393,14 @@ function onBeforeRequest(details) {
newuristr = newuristr.replace(/^http:/, "https:");
}
}
if (newuristr && newuristr.substring(0, 5) === "http:") {
// Abort early if we're about to redirect to HTTP in HTTP Nowhere mode
if (
newuristr &&
(
newuristr.substring(0, 5) === "http:" ||
newuristr.substring(0, 4) === "ftp:"
)
) {
// Abort early if we're about to redirect to HTTP or FTP in HTTP Nowhere mode
return {cancel: true};
}
}
Expand Down Expand Up @@ -636,7 +642,7 @@ function onHeadersReceived(details) {

// Registers the handler for requests
// See: https://github.com/EFForg/https-everywhere/issues/10039
chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: ["*://*/*"]}, ["blocking"]);
chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: ["*://*/*", "ftp://*/*"]}, ["blocking"]);

// Try to catch redirect loops on URLs we've redirected to HTTPS.
chrome.webRequest.onBeforeRedirect.addListener(onBeforeRedirect, {urls: ["https://*/*"]});
Expand Down
5 changes: 3 additions & 2 deletions chromium/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"tabs",
"cookies",
"storage",
"*://*/*"
"*://*/*",
"ftp://*/*"
],
"version": "2018.6.21"
}
}