mirror of
https://github.com/Heretek-AI/heretek-control-core.git
synced 2026-10-12 02:03:55 +00:00
Bug report Issue 1 (intermittent 'connector isn't responding' on shared LiteSpeed): send Cache-Control: no-store + X-LiteSpeed-Cache-Control: no-cache + X-Accel-Buffering: no on the MCP route so LiteSpeed/QUIC never caches or buffers MCP responses. Adds a readme FAQ (cache-exclusion + PHP limits + MCP Log) and an opt-in EMCP_TOOLS_PROFILE_REGISTRATION timing seam. The registrar was confirmed already lazy/cheap, so this targets the transport layer. Co-Authored-By: Claude Opus 4.8 <[email protected]>
44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* Host-mismatch guard (Bug report Issue 2).
|
|
*
|
|
* @package EMCP_Tools
|
|
*/
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
require_once __DIR__ . '/../includes/class-mcp-host-guard.php';
|
|
|
|
class McpHostGuardTest extends TestCase {
|
|
|
|
public function test_exact_match(): void {
|
|
$this->assertTrue(
|
|
EMCP_Tools_MCP_Host_Guard::host_matches( 'devis.debord-toiture.com', 'devis.debord-toiture.com' )
|
|
);
|
|
}
|
|
|
|
public function test_www_and_case_and_port_tolerant(): void {
|
|
$this->assertTrue(
|
|
EMCP_Tools_MCP_Host_Guard::host_matches( 'www.Example.com:443', 'example.com' )
|
|
);
|
|
}
|
|
|
|
public function test_different_domain_is_mismatch(): void {
|
|
$this->assertFalse(
|
|
EMCP_Tools_MCP_Host_Guard::host_matches( 'paleturquoise-sardine-346722.hostingersite.com', 'devis.debord-toiture.com' )
|
|
);
|
|
}
|
|
|
|
public function test_empty_request_host_is_not_a_mismatch(): void {
|
|
// A missing Host header must never brick the endpoint.
|
|
$this->assertTrue( EMCP_Tools_MCP_Host_Guard::host_matches( '', 'example.com' ) );
|
|
}
|
|
|
|
public function test_is_mcp_route(): void {
|
|
$this->assertTrue( EMCP_Tools_MCP_Host_Guard::is_mcp_route( '/mcp/emcp-tools-server' ) );
|
|
$this->assertTrue( EMCP_Tools_MCP_Host_Guard::is_mcp_route( '/mcp/emcp-tools-server/messages' ) );
|
|
$this->assertFalse( EMCP_Tools_MCP_Host_Guard::is_mcp_route( '/wp/v2/posts' ) );
|
|
$this->assertFalse( EMCP_Tools_MCP_Host_Guard::is_mcp_route( '/mcp/other-server' ) );
|
|
}
|
|
}
|