Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 917acfdb27 | |||
| 0fd90e8935 |
@@ -85,8 +85,9 @@ pub async fn validate_stream_token(proxy: &Proxy, provided: &str) -> std::result
|
|||||||
match token_guard.take() {
|
match token_guard.take() {
|
||||||
Some(expected) if expected == provided => Ok(()),
|
Some(expected) if expected == provided => Ok(()),
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
// Put the token back since it wasn't matched
|
// Wrong token: still consumed by the `take()` above. Any validation
|
||||||
// Actually no — the design is that any attempt consumes it for security
|
// attempt — correct or not — invalidates the token, so a wrong
|
||||||
|
// guess cannot be followed by a correct one.
|
||||||
Err("Invalid stream token".to_string())
|
Err("Invalid stream token".to_string())
|
||||||
}
|
}
|
||||||
None => Err("Stream token already used".to_string()),
|
None => Err("Stream token already used".to_string()),
|
||||||
|
|||||||
Reference in New Issue
Block a user