connect_via_proxy: Actually send initial handshake.
Our previous code would make a TCP connection to the proxy, then wait forever for it to say something. Whoops! Part of a fix for #676.
This commit is contained in:
parent
4afe128189
commit
475d9af34a
|
@ -108,9 +108,6 @@ pub(crate) async fn connect_via_proxy<R: TcpProvider + Send + Sync>(
|
||||||
let mut inbuf = [0_u8; 1024];
|
let mut inbuf = [0_u8; 1024];
|
||||||
let mut n_read = 0;
|
let mut n_read = 0;
|
||||||
let reply = loop {
|
let reply = loop {
|
||||||
// Read some more stuff.
|
|
||||||
n_read += stream.read(&mut inbuf[n_read..]).await?;
|
|
||||||
|
|
||||||
// try to advance the handshake to the next state.
|
// try to advance the handshake to the next state.
|
||||||
let action = match handshake.handshake(&inbuf[..n_read]) {
|
let action = match handshake.handshake(&inbuf[..n_read]) {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
|
@ -142,6 +139,9 @@ pub(crate) async fn connect_via_proxy<R: TcpProvider + Send + Sync>(
|
||||||
if action.finished {
|
if action.finished {
|
||||||
break handshake.into_reply();
|
break handshake.into_reply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read some more stuff.
|
||||||
|
n_read += stream.read(&mut inbuf[n_read..]).await?;
|
||||||
};
|
};
|
||||||
|
|
||||||
let status = reply
|
let status = reply
|
||||||
|
|
Loading…
Reference in New Issue