mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-14 11:20:53 +08:00
fix(stash): correct TCP/HTTP network type handling in node generation
This commit is contained in:
@@ -251,10 +251,13 @@ class Stash extends AbstractProtocol
|
||||
|
||||
switch (data_get($protocol_settings, 'network')) {
|
||||
case 'tcp':
|
||||
$array['network'] = data_get($protocol_settings, 'network_settings.header.type', 'http');
|
||||
$array['http-opts']['path'] = data_get($protocol_settings, 'network_settings.header.request.path', ['/']);
|
||||
if ($host = data_get($protocol_settings, 'network_settings.header.request.headers.Host')) {
|
||||
$array['http-opts']['headers']['Host'] = $host;
|
||||
$headerType = data_get($protocol_settings, 'network_settings.header.type', 'tcp');
|
||||
$array['network'] = ($headerType === 'http') ? 'http' : 'tcp';
|
||||
if ($headerType === 'http') {
|
||||
$array['http-opts']['path'] = data_get($protocol_settings, 'network_settings.header.request.path', ['/']);
|
||||
if ($host = data_get($protocol_settings, 'network_settings.header.request.headers.Host')) {
|
||||
$array['http-opts']['headers']['Host'] = $host;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'ws':
|
||||
@@ -312,8 +315,9 @@ class Stash extends AbstractProtocol
|
||||
|
||||
switch (data_get($protocol_settings, 'network')) {
|
||||
case 'tcp':
|
||||
if ($headerType = data_get($protocol_settings, 'network_settings.header.type', 'tcp') != 'tcp') {
|
||||
$array['network'] = $headerType;
|
||||
$headerType = data_get($protocol_settings, 'network_settings.header.type', 'tcp');
|
||||
$array['network'] = ($headerType === 'http') ? 'http' : 'tcp';
|
||||
if ($headerType === 'http') {
|
||||
if ($httpOpts = array_filter([
|
||||
'headers' => data_get($protocol_settings, 'network_settings.header.request.headers'),
|
||||
'path' => data_get($protocol_settings, 'network_settings.header.request.path', ['/'])
|
||||
@@ -355,8 +359,11 @@ class Stash extends AbstractProtocol
|
||||
$array['udp'] = true;
|
||||
switch (data_get($protocol_settings, 'network')) {
|
||||
case 'tcp':
|
||||
$array['network'] = data_get($protocol_settings, 'network_settings.header.type');
|
||||
$array['http-opts']['path'] = data_get($protocol_settings, 'network_settings.header.request.path', ['/']);
|
||||
$headerType = data_get($protocol_settings, 'network_settings.header.type', 'tcp');
|
||||
$array['network'] = ($headerType === 'http') ? 'http' : 'tcp';
|
||||
if ($headerType === 'http') {
|
||||
$array['http-opts']['path'] = data_get($protocol_settings, 'network_settings.header.request.path', ['/']);
|
||||
}
|
||||
break;
|
||||
case 'ws':
|
||||
$array['network'] = 'ws';
|
||||
|
||||
Reference in New Issue
Block a user