Skip to content

Commit

Permalink
Merge pull request #659 from Chilledheart/cli_close_on_unsupported_so…
Browse files Browse the repository at this point in the history
…ck_ops

cli: close on unsupported sock ops
  • Loading branch information
Chilledheart authored Jan 13, 2024
2 parents 6dc6af8 + cc78d7f commit e0245a2
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/cli/cli_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ void CliConnection::WriteMethodSelect() {

void CliConnection::WriteHandshake() {
scoped_refptr<CliConnection> self(this);

switch (CurrentState()) {
case state_method_select: // impossible
case state_socks5_handshake:
Expand Down Expand Up @@ -1369,31 +1370,31 @@ void CliConnection::ProcessReceivedData(
break;
case state_socks5_handshake:
ec = PerformCmdOpsV5(&s5_request_, &s5_reply_);
if (ec) {
break;
}
WriteHandshake();
VLOG(2) << "Connection (client) " << connection_id()
<< " socks5 handshake finished: ec: " << ec;
if (CurrentState() == state_stream) {
goto handle_stream;
}
break;
goto handle_stream;
case state_socks4_handshake:
ec = PerformCmdOpsV4(&s4_request_, &s4_reply_);
if (ec) {
break;
}
WriteHandshake();
VLOG(2) << "Connection (client) " << connection_id()
<< " socks4 handshake finished: ec:" << ec;
if (CurrentState() == state_stream) {
goto handle_stream;
}
break;
goto handle_stream;
case state_http_handshake:
ec = PerformCmdOpsHttp();
if (ec) {
break;
}
WriteHandshake();
VLOG(2) << "Connection (client) " << connection_id()
<< " http handshake finished: ec: " << ec;
if (CurrentState() == state_stream) {
goto handle_stream;
}
break;
goto handle_stream;
case state_stream:
handle_stream:
if (buf->length()) {
Expand Down

0 comments on commit e0245a2

Please sign in to comment.