From e49708b290544ba2d54ac4d86c29c12d0d8cef2d Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Tue, 14 Apr 2020 22:41:46 +0200 Subject: [PATCH] wip --- app/Commands/ShareCommand.php | 2 ++ app/Server/Connections/Connection.php | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Commands/ShareCommand.php b/app/Commands/ShareCommand.php index 9973457..7d8bb86 100644 --- a/app/Commands/ShareCommand.php +++ b/app/Commands/ShareCommand.php @@ -17,6 +17,8 @@ class ShareCommand extends Command { (new Factory()) ->setLoop(app(LoopInterface::class)) + //->setHost('beyond.sh') + //->setPort(8080) ->createClient($this->argument('host'), explode(',', $this->option('subdomain'))) ->createHttpServer() ->run(); diff --git a/app/Server/Connections/Connection.php b/app/Server/Connections/Connection.php index a745246..459bc9f 100644 --- a/app/Server/Connections/Connection.php +++ b/app/Server/Connections/Connection.php @@ -37,12 +37,10 @@ class Connection $appName = config('app.name'); $appVersion = config('app.version'); - return str_replace( - "Host: {$this->subdomain}.{$serverHost}:{$port}\r\n", - "Host: {$this->host}\r\n" . + $data = preg_replace('/Host: '.$this->subdomain.'.'.$serverHost.'(.*)\r\n/', "Host: {$this->host}\r\n" . "X-Tunnel-By: {$appName} {$appVersion}\r\n" . - "X-Original-Host: {$this->subdomain}.{$serverHost}:{$port}\r\n", - $data - ); + "X-Original-Host: {$this->subdomain}.{$serverHost}:{$port}\r\n", $data); + + return $data; } }