Przeglądaj źródła

remove server version

walkor 2 lat temu
rodzic
commit
f0994fb984
2 zmienionych plików z 7 dodań i 16 usunięć
  1. 3 5
      src/Protocols/Websocket.php
  2. 4 11
      src/Worker.php

+ 3 - 5
src/Protocols/Websocket.php

@@ -360,8 +360,7 @@ class Websocket
                 $SecWebSocketKey = $match[1];
             } else {
                 $connection->close(
-					'HTTP/1.1 200 OK\r\nServer: '. Worker::$processTitle . ' ('. Worker::VERSION . ')'
-					. '\r\n\r\n<div style="text-align:center"><h1>WebSocket</h1><hr>'. Worker::$processTitle . '/' . Worker::VERSION . '</div>', true);
+					"HTTP/1.0 200 OK\r\nServer: workerman\r\n\r\n<div style=\"text-align:center\"><h1>WebSocket</h1><hr>workerman</div>", true);
                 return 0;
             }
             // Calculation websocket key.
@@ -408,7 +407,7 @@ class Websocket
                 }
             }
             if (!$hasServerHeader) {
-                $handshakeMessage .= 'Server: ' . Worker::$processTitle . ' ('. Worker::VERSION . ')' . "\r\n";
+                $handshakeMessage .= "Server: workerman\r\n";
             }
             $handshakeMessage .= "\r\n";
             // Send handshake response.
@@ -428,8 +427,7 @@ class Websocket
         }
         // Bad websocket handshake request.
         $connection->close(
-			'HTTP/1.1 200 OK\r\nServer: ' . Worker::$processTitle . ' ('. Worker::VERSION . ')'
-			. '\r\n\r\n<div style="text-align:center"><h1>WebSocket</h1><hr>'. Worker::$processTitle . '/' . Worker::VERSION . '</div>', true);
+            "HTTP/1.0 200 OK\r\nServer: workerman\r\n\r\n<div style=\"text-align:center\"><h1>WebSocket</h1><hr>workerman</div>", true);
         return 0;
     }
 

+ 4 - 11
src/Worker.php

@@ -317,13 +317,6 @@ class Worker
     public static string $eventLoopClass = '';
 
     /**
-     * Process title
-     *
-     * @var string
-     */
-    public static string $processTitle = 'WorkerMan';
-
-    /**
      * After sending the stop command to the child process stopTimeout seconds,
      * if the process is still living then forced to kill.
      *
@@ -637,7 +630,7 @@ class Worker
         static::$globalStatistics['start_timestamp'] = time();
 
         // Process title.
-        static::setProcessTitle(static::$processTitle . ': master process  start_file=' . static::$startFile);
+        static::setProcessTitle('WorkerMan: master process  start_file=' . static::$startFile);
 
         // Init data for worker id.
         static::initId();
@@ -1594,7 +1587,7 @@ class Worker
 
             restore_error_handler();
 
-            static::setProcessTitle(self::$processTitle . ': worker process  ' . $worker->name . ' ' . $worker->getSocketName());
+            static::setProcessTitle('WorkerMan: worker process  ' . $worker->name . ' ' . $worker->getSocketName());
             $worker->setUserAndGroup();
             $worker->id = $id;
             $worker->run();
@@ -2608,7 +2601,7 @@ class Worker
         }
 
         $cmdline = "/proc/$masterPid/cmdline";
-        if (!is_readable($cmdline) || empty(static::$processTitle)) {
+        if (!is_readable($cmdline)) {
             return true;
         }
 
@@ -2617,7 +2610,7 @@ class Worker
             return true;
         }
 
-        return stripos($content, static::$processTitle) !== false || stripos($content, 'php') !== false;
+        return stripos($content, 'WorkerMan') !== false || stripos($content, 'php') !== false;
     }
 }