Skip to content

Commit 9ab33e4

Browse files
authored
Update App.php
增加控制http连接是否关闭属性
1 parent c372b09 commit 9ab33e4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

App.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ class App extends Worker
2424
*
2525
* @var string
2626
*/
27-
const VERSION = '0.3.0';
27+
const VERSION = '0.3.7';
2828

2929
private $conn = false;
30+
private $conn_close = true;
3031
private $map = array();
3132
private $access_log = array();
3233

@@ -93,14 +94,18 @@ private function auto_close($conn){
9394
if ( strtolower($_SERVER["SERVER_PROTOCOL"]) == "http/1.1" ){
9495
if ( isset($_SERVER["HTTP_CONNECTION"]) ){
9596
if ( strtolower($_SERVER["HTTP_CONNECTION"]) == "close" ){
96-
$conn->close();
97+
if ( $this->conn_close ){
98+
$conn->close();
99+
}
97100
}
98101
}
99102
}else{
100103
if ( $_SERVER["HTTP_CONNECTION"] == "keep-alive" ){
101104

102105
}else{
103-
$conn->close();
106+
if ( $this->conn_close ){
107+
$conn->close();
108+
}
104109
}
105110
}
106111
$this->access_log[7] = round(microtime_float() - $this->access_log[7],4);

0 commit comments

Comments
 (0)