mirror of
https://github.com/mikedilger/chorus.git
synced 2026-08-01 07:21:39 +00:00
Capture and log the Origin header (like the User-Agent header)
This commit is contained in:
parent
7883d75446
commit
d4c5459f23
@ -304,7 +304,12 @@ async fn handle_http_request(
|
||||
) -> Result<Response<Body>, Error> {
|
||||
let ua = match request.headers().get("user-agent") {
|
||||
Some(ua) => ua.to_str().unwrap_or("NON-UTF8-HEADER").to_owned(),
|
||||
None => "".to_owned(),
|
||||
None => "(no user-agent)".to_owned(),
|
||||
};
|
||||
|
||||
let origin = match request.headers().get("origin") {
|
||||
Some(o) => o.to_str().unwrap_or("NON-UTF8-HEADER").to_owned(),
|
||||
None => "(no origin)".to_owned(),
|
||||
};
|
||||
|
||||
if hyper_tungstenite::is_upgrade_request(&request) {
|
||||
@ -340,10 +345,11 @@ async fn handle_http_request(
|
||||
// as server messages
|
||||
log::info!(
|
||||
target: "Server",
|
||||
"{}: TOTAL={}, New Connection: {}",
|
||||
"{}: TOTAL={}, New Connection: {}, {}",
|
||||
peer,
|
||||
old_num_websockets + 1,
|
||||
ua
|
||||
origin,
|
||||
ua,
|
||||
);
|
||||
|
||||
// Everybody gets a ban on disconnect to prevent rapid reconnection
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user