Skip to content
Snippets Groups Projects
Commit 1e7a4827 authored by Phil Höfer's avatar Phil Höfer
Browse files

Check Auth Only If Query Exists

parent 65dab3b6
No related branches found
No related tags found
No related merge requests found
Pipeline #10006 passed
......@@ -77,25 +77,29 @@ fn main() -> Result<(), io::Error> {
// request.url(),
// request.headers()
// );
match config.get("auth") {
Some(server_auth) => {
match get_authkey(request.url().clone()) {
Ok(client_auth) => {
if client_auth != server_auth.clone() {
println!("invalid auth:{}, server auth: {}", client_auth, server_auth);
request.respond(Response::from_string(""));
continue;
}
},
_ => {}
}
},
_ => {}
}
let query = get_query(request.url());
//println!("got query:{}", query.clone().unwrap());
match query {
Ok(query) => {
match config.get("auth") {
Some(server_auth) => {
match get_authkey(request.url().clone()) {
Ok(client_auth) => {
if client_auth != server_auth.clone() {
println!("invalid auth:{}, server auth: {}", client_auth, server_auth);
request.respond(Response::from_string(""));
continue;
}
},
_ => {}
}
},
_ => {}
}
let predict_count = match config.get("max_predict_count") {
Some(n) if n.parse::<usize>().unwrap_or_default() > 0 => n.parse::<usize>().unwrap_or(5),
_ => 5
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment