Default port is now 1984 everywhere
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
This commit is contained in:
1 parent
dbe8a8d4e0
commit
bdccace271
9 files changed
+35
-35
No files matched your search
+3
-3
@@ -76,7 +76,7 @@ impl Default for ServerConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
bind: IpAddr::V4(Ipv4Addr::LOCALHOST),
|
||||
port: 9109,
|
||||
port: 1984,
|
||||
allowed_hosts: Vec::new(),
|
||||
allowed_origins: Vec::new(),
|
||||
tls: TlsConfig::default(),
|
||||
@@ -351,7 +351,7 @@ mod tests {
|
||||
Jail::expect_with(|_| {
|
||||
let c = load(None, &CliOverrides::default()).unwrap();
|
||||
assert_eq!(c, Config::default());
|
||||
assert_eq!(c.server.port, 9109);
|
||||
assert_eq!(c.server.port, 1984);
|
||||
assert!(c.auth.enabled);
|
||||
assert_eq!(c.limits.max_lines, 1000);
|
||||
assert_eq!(c.limits.max_follow_secs, 60);
|
||||
@@ -484,6 +484,6 @@ mod tests {
|
||||
.insert("authorization".into(), "secret".into());
|
||||
let s = c.to_toml_redacted().unwrap();
|
||||
assert!(!s.contains("secret"));
|
||||
assert!(s.contains("port = 9109"));
|
||||
assert!(s.contains("port = 1984"));
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -835,7 +835,7 @@ mod tests {
|
||||
cfg.server.allowed_origins = vec!["https://mon.example.com".into()];
|
||||
let st = fake_state(cfg);
|
||||
assert!(allowed_hosts(&st).contains(&"mon.example.com".to_string()));
|
||||
assert!(allowed_origins(&st).contains(&"http://localhost:9109".to_string()));
|
||||
assert!(allowed_origins(&st).contains(&"http://localhost:1984".to_string()));
|
||||
assert!(allowed_origins(&st).contains(&"https://mon.example.com".to_string()));
|
||||
let _svc = service(st);
|
||||
}
|
||||
@@ -846,8 +846,8 @@ mod tests {
|
||||
cfg.server.tls.enabled = true;
|
||||
let st = fake_state(cfg);
|
||||
let o = allowed_origins(&st);
|
||||
assert!(o.contains(&"https://localhost:9109".to_string()));
|
||||
assert!(o.contains(&"https://127.0.0.1:9109".to_string()));
|
||||
assert!(o.contains(&"https://localhost:1984".to_string()));
|
||||
assert!(o.contains(&"https://127.0.0.1:1984".to_string()));
|
||||
assert!(!o.iter().any(|x| x.starts_with("http://")));
|
||||
}
|
||||
|
||||
@@ -883,14 +883,14 @@ mod tests {
|
||||
b.body(Body::from(body)).unwrap()
|
||||
};
|
||||
let r = svc
|
||||
.call(mk("localhost:9109", Some("http://evil.example")))
|
||||
.call(mk("localhost:1984", Some("http://evil.example")))
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(r.status(), StatusCode::FORBIDDEN);
|
||||
let r = svc.call(mk("evil.example", None)).await.unwrap();
|
||||
assert_eq!(r.status(), StatusCode::FORBIDDEN);
|
||||
let r = svc
|
||||
.call(mk("localhost:9109", Some("http://localhost:9109")))
|
||||
.call(mk("localhost:1984", Some("http://localhost:1984")))
|
||||
.await
|
||||
.unwrap();
|
||||
assert_ne!(r.status(), StatusCode::FORBIDDEN);
|
||||
|
||||
+3
-3
@@ -181,7 +181,7 @@ fn allowed_hosts(c: &Config) -> Arc<Vec<String>> {
|
||||
Arc::new(v)
|
||||
}
|
||||
|
||||
/// Strip an optional port and IPv6 brackets: `[::1]:9109` -> `::1`.
|
||||
/// Strip an optional port and IPv6 brackets: `[::1]:1984` -> `::1`.
|
||||
fn host_only(h: &str) -> &str {
|
||||
let h = h.trim();
|
||||
if let Some(rest) = h.strip_prefix('[') {
|
||||
@@ -217,8 +217,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn host_parsing() {
|
||||
assert_eq!(host_only("localhost:9109"), "localhost");
|
||||
assert_eq!(host_only("[::1]:9109"), "::1");
|
||||
assert_eq!(host_only("localhost:1984"), "localhost");
|
||||
assert_eq!(host_only("[::1]:1984"), "::1");
|
||||
assert_eq!(host_only("::1"), "::1");
|
||||
assert_eq!(host_only("10.0.0.5"), "10.0.0.5");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user