Unverified Commit 3198d79e authored by Roman Zeyde's avatar Roman Zeyde
Browse files

Add naive check for SSL encrypted data

Currently, SSL connections are not supported.
parent d45dba26
......@@ -394,17 +394,18 @@ impl Connection {
tx.send(Message::Done).chain_err(|| "channel closed")?;
return Ok(());
} else {
if line.starts_with(&[22, 3, 1]) {
// (very) naive SSL handshake detection
let _ = tx.send(Message::Done);
bail!("invalid request - maybe SSL-encrypted data?: {:?}", line)
}
match String::from_utf8(line) {
Ok(req) => tx
.send(Message::Request(req))
.chain_err(|| "channel closed")?,
Err(err) => {
let _ = tx.send(Message::Done);
bail!(
"invalid UTF8 {:?}: {:?}",
String::from_utf8_lossy(err.as_bytes()),
err
)
bail!("invalid UTF8: {}", err)
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment