1
0
mirror of https://github.com/xPaw/PHP-Source-Query.git synced 2026-05-18 14:33:34 +02:00

Add 1200 byte padding to all requests

https://steamcommunity.com/discussions/forum/14/2989789048633291344/
This commit is contained in:
Pavel Djundik
2020-11-19 10:58:23 +02:00
parent 4f88fb0c76
commit 7231921b0b
4 changed files with 34 additions and 5 deletions
+8 -5
View File
@@ -200,7 +200,7 @@
throw new SocketException( 'Not connected.', SocketException::NOT_CONNECTED );
}
$this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" );
$this->Socket->WritePadded( self::A2S_INFO, "Source Engine Query\0" );
$Buffer = $this->Socket->Read( );
$Type = $Buffer->GetByte( );
@@ -365,7 +365,7 @@
$this->GetChallenge( self::A2S_PLAYER, self::S2A_PLAYER );
$this->Socket->Write( self::A2S_PLAYER, $this->Challenge );
$this->Socket->WritePadded( self::A2S_PLAYER, $this->Challenge );
$Buffer = $this->Socket->Read( 14000 ); // Moronic Arma 3 developers do not split their packets, so we have to read more data
// This violates the protocol spec, and they probably should fix it: https://developer.valvesoftware.com/wiki/Server_queries#Protocol
@@ -411,7 +411,7 @@
$this->GetChallenge( self::A2S_RULES, self::S2A_RULES );
$this->Socket->Write( self::A2S_RULES, $this->Challenge );
$this->Socket->WritePadded( self::A2S_RULES, $this->Challenge );
$Buffer = $this->Socket->Read( );
$Type = $Buffer->GetByte( );
@@ -452,10 +452,13 @@
if( $this->UseOldGetChallengeMethod )
{
$Header = self::A2S_SERVERQUERY_GETCHALLENGE;
$this->Socket->Write( self::A2S_SERVERQUERY_GETCHALLENGE, "\xFF\xFF\xFF\xFF" );
}
else
{
$this->Socket->WritePadded( $Header, "\xFF\xFF\xFF\xFF" );
}
$this->Socket->Write( $Header, "\xFF\xFF\xFF\xFF" );
$Buffer = $this->Socket->Read( );
$Type = $Buffer->GetByte( );