Skip to content

Commit 1a504fd

Browse files
Merge #1533
1533: Rename blacklist_ips to block_ips r=carols10cents a=sgrif Co-authored-by: Sean Griffin <[email protected]>
2 parents 7fc9d43 + ca497a6 commit 1a504fd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/middleware/blacklist_ips.rs renamed to src/middleware/block_ips.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ impl AroundMiddleware for BlockIps {
2727

2828
impl Handler for BlockIps {
2929
fn call(&self, req: &mut dyn Request) -> Result<Response, Box<dyn Error + Send>> {
30-
let has_blacklisted_ip = req
30+
let has_blocked_ip = req
3131
.headers()
3232
.find("X-Forwarded-For")
3333
.unwrap()
3434
.iter()
3535
.any(|v| v.split(", ").any(|ip| self.ips.iter().any(|x| x == ip)));
36-
if has_blacklisted_ip {
36+
if has_blocked_ip {
3737
let body = format!(
3838
"We are unable to process your request at this time. \
3939
Please open an issue at https://github.com/rust-lang/crates.io \

src/middleware/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub use self::security_headers::SecurityHeaders;
1313
pub use self::static_or_continue::StaticOrContinue;
1414

1515
pub mod app;
16-
mod blacklist_ips;
16+
mod block_ips;
1717
pub mod current_user;
1818
mod debug;
1919
mod ember_index_rewrite;
@@ -81,9 +81,9 @@ pub fn build_middleware(app: Arc<App>, endpoints: R404) -> MiddlewareBuilder {
8181

8282
m.around(Head::default());
8383

84-
if let Ok(ip_list) = env::var("BLACKLISTED_IPS") {
84+
if let Ok(ip_list) = env::var("BLOCKED_IPS") {
8585
let ips = ip_list.split(',').map(String::from).collect();
86-
m.around(blacklist_ips::BlockIps::new(ips));
86+
m.around(block_ips::BlockIps::new(ips));
8787
}
8888

8989
if env != Env::Test {

0 commit comments

Comments
 (0)