Skip to content

Commit b227894

Browse files
committed
Add support for challenges in A2S_INFO
Thanks to xPaw for the implementation
1 parent 5b3a3f1 commit b227894

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

web/includes/SourceQuery/SourceQuery.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,28 @@ public function GetInfo( )
206206
throw new SocketException( 'Not connected.', SocketException::NOT_CONNECTED );
207207
}
208208

209-
$this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" );
209+
if( $this->Challenge )
210+
{
211+
$this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" . $this->Challenge );
212+
}
213+
else
214+
{
215+
$this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" );
216+
}
217+
210218
$Buffer = $this->Socket->Read( );
211219

212220
$Type = $Buffer->GetByte( );
213221

222+
if( $Type === self::S2A_CHALLENGE )
223+
{
224+
$this->Challenge = $Buffer->Get( 4 );
225+
226+
$this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" . $this->Challenge );
227+
$Buffer = $this->Socket->Read( );
228+
$Type = $Buffer->GetByte( );
229+
}
230+
214231
// Old GoldSource protocol, HLTV still uses it
215232
if( $Type === self::S2A_INFO_OLD && $this->Socket->Engine === self::GOLDSOURCE )
216233
{

0 commit comments

Comments
 (0)