Cleanup blocking fetch operations with bad ports (#35324)

Blocking a fetch due to a bad port should be grouped together
with CSP blocks as per the spec, but these steps were previously
seperated.

Additionally, remove handling of ftp in
should_request_be_blocked_due_to_a_bad_port, since it did nothing
anyways.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-02-06 17:47:29 +01:00 committed by GitHub
parent 18b43d48fc
commit 0ebdf146fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 42 deletions

View file

@ -39,7 +39,7 @@ use url::Url;
use crate::async_runtime::HANDLE;
use crate::connector::{create_tls_config, CACertificates, TlsConfig};
use crate::cookie::ServoCookie;
use crate::fetch::methods::should_be_blocked_due_to_bad_port;
use crate::fetch::methods::should_request_be_blocked_due_to_a_bad_port;
use crate::hosts::replace_host;
use crate::http_loader::HttpState;
/// Create a tungstenite Request object for the initial HTTP request.
@ -371,7 +371,7 @@ fn connect(
let req_url = req_builder.url.clone();
if should_be_blocked_due_to_bad_port(&req_url) {
if should_request_be_blocked_due_to_a_bad_port(&req_url) {
return Err("Port blocked".to_string());
}