summaryrefslogtreecommitdiff
path: root/sapi/litespeed
diff options
context:
space:
mode:
authorGeorge Wang <gwang@php.net>2019-04-21 15:59:49 -0400
committerGeorge Wang <gwang@php.net>2019-04-21 15:59:49 -0400
commitbd86ae4b8a51e8a481f0c31e5854d2d37db11cd7 (patch)
tree6badc843d6d4064554c901f00366eab092dac83a /sapi/litespeed
parentb1d3509e8c22f1ae12b6462e7732baddedde9bdd (diff)
parentfb4c811835c906ff51f9181ae9e4b6c96d04cebb (diff)
downloadphp-git-bd86ae4b8a51e8a481f0c31e5854d2d37db11cd7.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
Diffstat (limited to 'sapi/litespeed')
-rw-r--r--sapi/litespeed/lsapi_main.c7
-rw-r--r--sapi/litespeed/lsapilib.c27
2 files changed, 22 insertions, 12 deletions
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index 66f973ada8..078827c721 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -448,7 +448,7 @@ static int sapi_lsapi_activate()
static sapi_module_struct lsapi_sapi_module =
{
"litespeed",
- "LiteSpeed V7.3",
+ "LiteSpeed V7.3.1",
php_lsapi_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
@@ -1380,7 +1380,6 @@ static const zend_function_entry litespeed_functions[] = {
PHP_FALIAS(getallheaders, litespeed_request_headers, arginfo_litespeed__void)
PHP_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_litespeed__void)
PHP_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_litespeed__void)
- PHP_FALIAS(fastcgi_finish_request, litespeed_finish_request, arginfo_litespeed__void)
{NULL, NULL, NULL}
};
@@ -1516,6 +1515,10 @@ PHP_FUNCTION(litespeed_finish_request)
if (ZEND_NUM_ARGS() > 0) {
WRONG_PARAM_COUNT;
}
+
+ php_output_end_all();
+ php_header();
+
if (LSAPI_End_Response() != -1) {
RETURN_TRUE;
}
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index 00d5592623..d6e1e2b350 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -1602,8 +1602,11 @@ int LSAPI_Accept_r( LSAPI_Request * pReq )
}
-static struct lsapi_packet_header finish = {'L', 'S',
- LSAPI_RESP_END, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} };
+static struct lsapi_packet_header finish_close[2] =
+{
+ {'L', 'S', LSAPI_RESP_END, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} },
+ {'L', 'S', LSAPI_CONN_CLOSE, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} }
+};
int LSAPI_Finish_r( LSAPI_Request * pReq )
@@ -1624,7 +1627,7 @@ int LSAPI_Finish_r( LSAPI_Request * pReq )
Flush_RespBuf_r( pReq );
}
- pReq->m_pIovecCur->iov_base = (void *)&finish;
+ pReq->m_pIovecCur->iov_base = (void *)finish_close;
pReq->m_pIovecCur->iov_len = LSAPI_PACKET_HEADER_LEN;
pReq->m_totalLen += LSAPI_PACKET_HEADER_LEN;
++pReq->m_pIovecCur;
@@ -1640,12 +1643,17 @@ int LSAPI_End_Response_r(LSAPI_Request * pReq)
{
if (!pReq)
return -1;
+ if (pReq->m_reqState & LSAPI_ST_BACKGROUND)
+ return 0;
if (pReq->m_reqState)
{
if ( pReq->m_fd != -1 )
{
if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER )
{
+ if ( pReq->m_pRespHeaderBufPos <= pReq->m_pRespHeaderBuf )
+ return 0;
+
LSAPI_FinalizeRespHeaders_r( pReq );
}
if ( pReq->m_pRespBufPos != pReq->m_pRespBuf )
@@ -1653,14 +1661,13 @@ int LSAPI_End_Response_r(LSAPI_Request * pReq)
Flush_RespBuf_r( pReq );
}
- pReq->m_pIovecCur->iov_base = (void *)&finish;
- pReq->m_pIovecCur->iov_len = LSAPI_PACKET_HEADER_LEN;
- pReq->m_totalLen += LSAPI_PACKET_HEADER_LEN;
+ pReq->m_pIovecCur->iov_base = (void *)finish_close;
+ pReq->m_pIovecCur->iov_len = LSAPI_PACKET_HEADER_LEN << 1;
+ pReq->m_totalLen += LSAPI_PACKET_HEADER_LEN << 1;
++pReq->m_pIovecCur;
LSAPI_Flush_r( pReq );
+ lsapi_close_connection(pReq);
}
- send_conn_close_notification(pReq->m_fd);
- lsapi_close_connection(pReq);
pReq->m_reqState |= LSAPI_ST_BACKGROUND;
}
return 0;
@@ -3165,8 +3172,8 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer,
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
*s_avail_pages = sysconf(_SC_AVPHYS_PAGES);
- lsapi_log("Memory total: %zd, free: %zd, free %%%zd\n",
- s_total_pages, *s_avail_pages, *s_avail_pages * 100 / s_total_pages);
+// lsapi_log("Memory total: %zd, free: %zd, free %%%zd\n",
+// s_total_pages, *s_avail_pages, *s_avail_pages * 100 / s_total_pages);
#endif
FD_ZERO( &readfds );