Convert IAC IAC to IAC in Telnet Binary Mode
This commit is contained in:
parent
ae9445aa33
commit
07e42e2f5e
@ -433,7 +433,34 @@ final class SocketClient {
|
||||
if ($flags !== MSG_PEEK)
|
||||
$this->rx_buf = substr($this->rx_buf,strlen($result));
|
||||
|
||||
return $result;
|
||||
// In case we are in Telnet Binary Mode
|
||||
if ($this->iac_bin) {
|
||||
if (self::DEBUG)
|
||||
Log::debug(sprintf('%s:- Telnet IAC Binary Mode, looking for ff ff',self::LOGKEY));
|
||||
|
||||
// if the last char is ff, we need to get the next char
|
||||
if (str_ends_with($result,"\xff")) {
|
||||
// If we have it in our buffer, just get it
|
||||
if ($this->rx_left) {
|
||||
$result .= substr($this->rx_buf,0,1);
|
||||
$this->rx_buf = substr($this->rx_buf,1);
|
||||
|
||||
// Else put everything back into rx_buf, and increase len by 1
|
||||
} else {
|
||||
$this->rx_buf = $result;
|
||||
$len++;
|
||||
$result = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($result) > 1)
|
||||
$result = str_replace("\xff\xff","\xff",$result);
|
||||
|
||||
if ($result)
|
||||
return $result;
|
||||
|
||||
} else
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (self::DEBUG)
|
||||
|
Loading…
x
Reference in New Issue
Block a user