|
@@ -311,6 +311,7 @@ mod tests {
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.19".to_string(),
|
|
version: "0.8.1.19".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -652,6 +653,7 @@ mod tests {
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.19".to_string(),
|
|
version: "0.8.1.19".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -825,6 +827,7 @@ mod tests {
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.19".to_string(),
|
|
version: "0.8.1.19".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -891,6 +894,7 @@ mod tests {
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.19".to_string(),
|
|
version: "0.8.1.19".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -1143,6 +1147,7 @@ mod tests {
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.19".to_string(),
|
|
version: "0.8.1.19".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -2475,6 +2480,7 @@ Finished pass #1 (of 1) (Cumulative error count: 9, buffer full count: 0)\r\n",
|
|
|
web_dir: Path::new("/workspace/XJKJ-STL/web").to_path_buf(),
|
|
web_dir: Path::new("/workspace/XJKJ-STL/web").to_path_buf(),
|
|
|
contracts_path: Path::new("/workspace/XJKJ-STL/contracts/firmware-vd012.json")
|
|
contracts_path: Path::new("/workspace/XJKJ-STL/contracts/firmware-vd012.json")
|
|
|
.to_path_buf(),
|
|
.to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.24".to_string(),
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "test".to_string(),
|
|
commit: "test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -2707,6 +2713,7 @@ Finished pass #1 (of 1) (Cumulative error count: 9, buffer full count: 0)\r\n",
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.24".to_string(),
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -2854,6 +2861,7 @@ Finished pass #1 (of 1) (Cumulative error count: 9, buffer full count: 0)\r\n",
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.24".to_string(),
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -2961,6 +2969,7 @@ Finished pass #1 (of 1) (Cumulative error count: 9, buffer full count: 0)\r\n",
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.24".to_string(),
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -3130,6 +3139,7 @@ N1.C11.D0: FPT: DisableDIMM()\r\n\
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.24".to_string(),
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -3334,6 +3344,7 @@ Reset Type: Warm Reset\r\n\
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.24".to_string(),
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -3482,6 +3493,7 @@ UEFI Interactive Shell v2.2\r\nFS0:\\EFI\\> \r\n\
|
|
|
tftp_listen: "disabled".to_string(),
|
|
tftp_listen: "disabled".to_string(),
|
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
web_dir: Path::new("web").to_path_buf(),
|
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: None,
|
|
|
version: "0.8.1.25".to_string(),
|
|
version: "0.8.1.25".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
commit: "unit-test".to_string(),
|
|
|
};
|
|
};
|
|
@@ -3631,4 +3643,207 @@ Please press ENTER to start UIP\r\n\
|
|
|
|
|
|
|
|
let _ = std::fs::remove_dir_all(&tmp_dir);
|
|
let _ = std::fs::remove_dir_all(&tmp_dir);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ #[test]
|
|
|
|
|
+ fn test_web_admin_password_auth_and_qt_clean_bypass() {
|
|
|
|
|
+ use std::io::{Read, Write};
|
|
|
|
|
+ use std::net::{TcpListener, TcpStream};
|
|
|
|
|
+ use std::sync::atomic::{AtomicBool, Ordering};
|
|
|
|
|
+ use std::sync::Arc;
|
|
|
|
|
+ use std::thread;
|
|
|
|
|
+
|
|
|
|
|
+ let tmp_dir = std::env::temp_dir().join(format!(
|
|
|
|
|
+ "stl_web_admin_auth_{}_{}",
|
|
|
|
|
+ std::process::id(),
|
|
|
|
|
+ now_ms()
|
|
|
|
|
+ ));
|
|
|
|
|
+ let _ = std::fs::remove_dir_all(&tmp_dir);
|
|
|
|
|
+ std::fs::create_dir_all(&tmp_dir).unwrap();
|
|
|
|
|
+ // Verify normalize_web_password defaults & overrides
|
|
|
|
|
+ assert_eq!(
|
|
|
|
|
+ crate::config::normalize_web_password(None),
|
|
|
|
|
+ Some("xjkj123456!".to_string())
|
|
|
|
|
+ );
|
|
|
|
|
+ assert_eq!(
|
|
|
|
|
+ crate::config::normalize_web_password(Some(" ".to_string())),
|
|
|
|
|
+ Some("xjkj123456!".to_string())
|
|
|
|
|
+ );
|
|
|
|
|
+ assert_eq!(
|
|
|
|
|
+ crate::config::normalize_web_password(Some("disabled".to_string())),
|
|
|
|
|
+ None
|
|
|
|
|
+ );
|
|
|
|
|
+ assert_eq!(
|
|
|
|
|
+ crate::config::normalize_web_password(Some("customPass!".to_string())),
|
|
|
|
|
+ Some("customPass!".to_string())
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ let args = ServerArgs {
|
|
|
|
|
+ config_path: Path::new("config/backend.example.json").to_path_buf(),
|
|
|
|
|
+ data_dir: tmp_dir.clone(),
|
|
|
|
|
+ web_listen: "127.0.0.1:0".to_string(),
|
|
|
|
|
+ tftp_listen: "disabled".to_string(),
|
|
|
|
|
+ web_dir: Path::new("web").to_path_buf(),
|
|
|
|
|
+ contracts_path: Path::new("contracts/firmware-vd012.json").to_path_buf(),
|
|
|
|
|
+ web_password: Some("xjkj123456!".to_string()),
|
|
|
|
|
+ version: "0.8.1.26".to_string(),
|
|
|
|
|
+ commit: "unit-test".to_string(),
|
|
|
|
|
+ };
|
|
|
|
|
+ let hub = AppHub::init_for_test(&args);
|
|
|
|
|
+
|
|
|
|
|
+ let listener = TcpListener::bind("127.0.0.1:0").unwrap();
|
|
|
|
|
+ let addr = listener.local_addr().unwrap();
|
|
|
|
|
+ let stop_flag = Arc::new(AtomicBool::new(false));
|
|
|
|
|
+ let stop_srv = Arc::clone(&stop_flag);
|
|
|
|
|
+ let hub_srv = Arc::clone(&hub);
|
|
|
|
|
+ listener.set_nonblocking(true).unwrap();
|
|
|
|
|
+ let srv_thread = thread::spawn(move || {
|
|
|
|
|
+ while !stop_srv.load(Ordering::Acquire) {
|
|
|
|
|
+ match listener.accept() {
|
|
|
|
|
+ Ok((sock, _)) => {
|
|
|
|
|
+ let _ = sock.set_nonblocking(false);
|
|
|
|
|
+ let h = Arc::clone(&hub_srv);
|
|
|
|
|
+ thread::spawn(move || crate::api::handle_http_client(sock, h));
|
|
|
|
|
+ }
|
|
|
|
|
+ Err(ref e) if e.kind() == std::io::ErrorKind::WouldBlock => {
|
|
|
|
|
+ thread::sleep(Duration::from_millis(5));
|
|
|
|
|
+ }
|
|
|
|
|
+ Err(_) => break,
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ let send_http = |req: &str| -> String {
|
|
|
|
|
+ let mut cli = TcpStream::connect(addr).unwrap();
|
|
|
|
|
+ cli.write_all(req.as_bytes()).unwrap();
|
|
|
|
|
+ let mut raw = Vec::new();
|
|
|
|
|
+ cli.read_to_end(&mut raw).unwrap();
|
|
|
|
|
+ String::from_utf8_lossy(&raw).into_owned()
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 1. Unauthenticated HTTP management assets & APIs must be rejected (401)
|
|
|
|
|
+ let r_root = send_http("GET / HTTP/1.1\r\nHost: localhost\r\n\r\n");
|
|
|
|
|
+ assert!(r_root.starts_with("HTTP/1.1 401 Unauthorized"));
|
|
|
|
|
+ assert!(r_root.contains("/api/auth/login"));
|
|
|
|
|
+ assert!(!r_root.contains("WWW-Authenticate:"));
|
|
|
|
|
+
|
|
|
|
|
+ let r_js = send_http("GET /app.js HTTP/1.1\r\nHost: localhost\r\n\r\n");
|
|
|
|
|
+ assert!(r_js.starts_with("HTTP/1.1 401 Unauthorized"));
|
|
|
|
|
+
|
|
|
|
|
+ let r_contract = send_http("GET /contracts/firmware-vd012.json HTTP/1.1\r\nHost: localhost\r\n\r\n");
|
|
|
|
|
+ assert!(r_contract.starts_with("HTTP/1.1 401 Unauthorized"));
|
|
|
|
|
+
|
|
|
|
|
+ let r_csv = send_http("GET /api/thermal/export.csv?station_id=S1 HTTP/1.1\r\nHost: localhost\r\n\r\n");
|
|
|
|
|
+ assert!(r_csv.starts_with("HTTP/1.1 401 Unauthorized"));
|
|
|
|
|
+
|
|
|
|
|
+ // 2. Unauthenticated full /ws upgrade must be rejected (401), NOT 101
|
|
|
|
|
+ let r_ws_unauth = send_http(
|
|
|
|
|
+ "GET /ws HTTP/1.1\r\nHost: localhost\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n",
|
|
|
|
|
+ );
|
|
|
|
|
+ assert!(r_ws_unauth.starts_with("HTTP/1.1 401 Unauthorized"));
|
|
|
|
|
+
|
|
|
|
|
+ // 3. Unauthenticated /ws?view=qt-clean MUST succeed (101) and remain usable without password
|
|
|
|
|
+ {
|
|
|
|
|
+ let mut cli = TcpStream::connect(addr).unwrap();
|
|
|
|
|
+ cli.set_read_timeout(Some(Duration::from_secs(3))).unwrap();
|
|
|
|
|
+ cli.write_all(b"GET /ws?view=qt-clean HTTP/1.1\r\nHost: localhost\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n").unwrap();
|
|
|
|
|
+ let mut hdr_buf = [0u8; 512];
|
|
|
|
|
+ let n = cli.read(&mut hdr_buf).unwrap();
|
|
|
|
|
+ let hs = String::from_utf8_lossy(&hdr_buf[..n]);
|
|
|
|
|
+ assert!(hs.starts_with("HTTP/1.1 101 Switching Protocols"), "qt-clean hs: {}", hs);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 4. Wrong password login returns 401 without Set-Cookie
|
|
|
|
|
+ let wrong_body = r#"{"password":"wrong-password"}"#;
|
|
|
|
|
+ let r_wrong = send_http(&format!(
|
|
|
|
|
+ "POST /api/auth/login HTTP/1.1\r\nHost: localhost\r\nContent-Type: application/json\r\nContent-Length: {}\r\n\r\n{}",
|
|
|
|
|
+ wrong_body.len(),
|
|
|
|
|
+ wrong_body
|
|
|
|
|
+ ));
|
|
|
|
|
+ assert!(r_wrong.starts_with("HTTP/1.1 401 Unauthorized"));
|
|
|
|
|
+ assert!(!r_wrong.contains("Set-Cookie: stl_auth="));
|
|
|
|
|
+
|
|
|
|
|
+ // 5. Correct password login returns 200 + Set-Cookie: stl_auth=...
|
|
|
|
|
+ let ok_body = r#"{"password":"xjkj123456!"}"#;
|
|
|
|
|
+ let r_login = send_http(&format!(
|
|
|
|
|
+ "POST /api/auth/login HTTP/1.1\r\nHost: localhost\r\nContent-Type: application/json\r\nContent-Length: {}\r\n\r\n{}",
|
|
|
|
|
+ ok_body.len(),
|
|
|
|
|
+ ok_body
|
|
|
|
|
+ ));
|
|
|
|
|
+ assert!(r_login.starts_with("HTTP/1.1 200 OK"), "login resp: {}", r_login);
|
|
|
|
|
+ let cookie_line = r_login
|
|
|
|
|
+ .lines()
|
|
|
|
|
+ .find(|l| l.to_ascii_lowercase().starts_with("set-cookie: stl_auth="))
|
|
|
|
|
+ .expect("missing stl_auth Set-Cookie");
|
|
|
|
|
+ let cookie_pair = cookie_line
|
|
|
|
|
+ .split(':')
|
|
|
|
|
+ .nth(1)
|
|
|
|
|
+ .unwrap()
|
|
|
|
|
+ .trim()
|
|
|
|
|
+ .split(';')
|
|
|
|
|
+ .next()
|
|
|
|
|
+ .unwrap()
|
|
|
|
|
+ .to_string();
|
|
|
|
|
+
|
|
|
|
|
+ // 6. Authenticated requests with Cookie succeed (/, /app.js, /contracts/*, and /ws)
|
|
|
|
|
+ let r_index_ok = send_http(&format!(
|
|
|
|
|
+ "GET / HTTP/1.1\r\nHost: localhost\r\nCookie: {}\r\n\r\n",
|
|
|
|
|
+ cookie_pair
|
|
|
|
|
+ ));
|
|
|
|
|
+ assert!(r_index_ok.starts_with("HTTP/1.1 200 OK"));
|
|
|
|
|
+ assert!(r_index_ok.contains("btn-web-logout"));
|
|
|
|
|
+
|
|
|
|
|
+ let r_appjs_ok = send_http(&format!(
|
|
|
|
|
+ "GET /app.js HTTP/1.1\r\nHost: localhost\r\nCookie: {}\r\n\r\n",
|
|
|
|
|
+ cookie_pair
|
|
|
|
|
+ ));
|
|
|
|
|
+ assert!(r_appjs_ok.starts_with("HTTP/1.1 200 OK"));
|
|
|
|
|
+
|
|
|
|
|
+ {
|
|
|
|
|
+ let mut cli = TcpStream::connect(addr).unwrap();
|
|
|
|
|
+ cli.set_read_timeout(Some(Duration::from_secs(3))).unwrap();
|
|
|
|
|
+ cli.write_all(
|
|
|
|
|
+ format!(
|
|
|
|
|
+ "GET /ws HTTP/1.1\r\nHost: localhost\r\nCookie: {}\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n",
|
|
|
|
|
+ cookie_pair
|
|
|
|
|
+ )
|
|
|
|
|
+ .as_bytes(),
|
|
|
|
|
+ )
|
|
|
|
|
+ .unwrap();
|
|
|
|
|
+ let mut hdr_buf = [0u8; 512];
|
|
|
|
|
+ let n = cli.read(&mut hdr_buf).unwrap();
|
|
|
|
|
+ let hs = String::from_utf8_lossy(&hdr_buf[..n]);
|
|
|
|
|
+ assert!(hs.starts_with("HTTP/1.1 101 Switching Protocols"), "authed ws hs: {}", hs);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 7. Authorization: Basic (admin:xjkj123456!) succeeds, bad Basic fails
|
|
|
|
|
+ let basic_ok = crate::lib::b64_encode(b"admin:xjkj123456!");
|
|
|
|
|
+ let r_basic_ok = send_http(&format!(
|
|
|
|
|
+ "GET /contracts/firmware-vd012.json HTTP/1.1\r\nHost: localhost\r\nAuthorization: Basic {}\r\n\r\n",
|
|
|
|
|
+ basic_ok
|
|
|
|
|
+ ));
|
|
|
|
|
+ assert!(r_basic_ok.starts_with("HTTP/1.1 200 OK"));
|
|
|
|
|
+
|
|
|
|
|
+ let basic_bad = crate::lib::b64_encode(b"admin:wrong");
|
|
|
|
|
+ let r_basic_bad = send_http(&format!(
|
|
|
|
|
+ "GET /contracts/firmware-vd012.json HTTP/1.1\r\nHost: localhost\r\nAuthorization: Basic {}\r\n\r\n",
|
|
|
|
|
+ basic_bad
|
|
|
|
|
+ ));
|
|
|
|
|
+ assert!(r_basic_bad.starts_with("HTTP/1.1 401 Unauthorized"));
|
|
|
|
|
+
|
|
|
|
|
+ // 8. Logout invalidates the session cookie
|
|
|
|
|
+ let r_logout = send_http(&format!(
|
|
|
|
|
+ "POST /api/auth/logout HTTP/1.1\r\nHost: localhost\r\nCookie: {}\r\nContent-Length: 0\r\n\r\n",
|
|
|
|
|
+ cookie_pair
|
|
|
|
|
+ ));
|
|
|
|
|
+ assert!(r_logout.starts_with("HTTP/1.1 200 OK"));
|
|
|
|
|
+ let r_after_logout = send_http(&format!(
|
|
|
|
|
+ "GET / HTTP/1.1\r\nHost: localhost\r\nCookie: {}\r\n\r\n",
|
|
|
|
|
+ cookie_pair
|
|
|
|
|
+ ));
|
|
|
|
|
+ assert!(r_after_logout.starts_with("HTTP/1.1 401 Unauthorized"));
|
|
|
|
|
+
|
|
|
|
|
+ stop_flag.store(true, Ordering::Release);
|
|
|
|
|
+ let _ = srv_thread.join();
|
|
|
|
|
+ let _ = std::fs::remove_dir_all(&tmp_dir);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|