Skip to content

Commit fb4c811

Browse files
author
George Wang
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents 0b84148 + ce73841 commit fb4c811

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

sapi/litespeed/lsapi_main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static int sapi_lsapi_activate()
455455
static sapi_module_struct lsapi_sapi_module =
456456
{
457457
"litespeed",
458-
"LiteSpeed V7.3",
458+
"LiteSpeed V7.3.1",
459459

460460
php_lsapi_startup, /* startup */
461461
php_module_shutdown_wrapper, /* shutdown */
@@ -1390,7 +1390,6 @@ static const zend_function_entry litespeed_functions[] = {
13901390
PHP_FALIAS(getallheaders, litespeed_request_headers, arginfo_litespeed__void)
13911391
PHP_FALIAS(apache_request_headers, litespeed_request_headers, arginfo_litespeed__void)
13921392
PHP_FALIAS(apache_response_headers, litespeed_response_headers, arginfo_litespeed__void)
1393-
PHP_FALIAS(fastcgi_finish_request, litespeed_finish_request, arginfo_litespeed__void)
13941393
{NULL, NULL, NULL}
13951394
};
13961395

@@ -1526,6 +1525,10 @@ PHP_FUNCTION(litespeed_finish_request)
15261525
if (ZEND_NUM_ARGS() > 0) {
15271526
WRONG_PARAM_COUNT;
15281527
}
1528+
1529+
php_output_end_all();
1530+
php_header();
1531+
15291532
if (LSAPI_End_Response() != -1) {
15301533
RETURN_TRUE;
15311534
}

sapi/litespeed/lsapilib.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,8 +1600,11 @@ int LSAPI_Accept_r( LSAPI_Request * pReq )
16001600
}
16011601

16021602

1603-
static struct lsapi_packet_header finish = {'L', 'S',
1604-
LSAPI_RESP_END, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} };
1603+
static struct lsapi_packet_header finish_close[2] =
1604+
{
1605+
{'L', 'S', LSAPI_RESP_END, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} },
1606+
{'L', 'S', LSAPI_CONN_CLOSE, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} }
1607+
};
16051608

16061609

16071610
int LSAPI_Finish_r( LSAPI_Request * pReq )
@@ -1622,7 +1625,7 @@ int LSAPI_Finish_r( LSAPI_Request * pReq )
16221625
Flush_RespBuf_r( pReq );
16231626
}
16241627

1625-
pReq->m_pIovecCur->iov_base = (void *)&finish;
1628+
pReq->m_pIovecCur->iov_base = (void *)finish_close;
16261629
pReq->m_pIovecCur->iov_len = LSAPI_PACKET_HEADER_LEN;
16271630
pReq->m_totalLen += LSAPI_PACKET_HEADER_LEN;
16281631
++pReq->m_pIovecCur;
@@ -1638,27 +1641,31 @@ int LSAPI_End_Response_r(LSAPI_Request * pReq)
16381641
{
16391642
if (!pReq)
16401643
return -1;
1644+
if (pReq->m_reqState & LSAPI_ST_BACKGROUND)
1645+
return 0;
16411646
if (pReq->m_reqState)
16421647
{
16431648
if ( pReq->m_fd != -1 )
16441649
{
16451650
if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER )
16461651
{
1652+
if ( pReq->m_pRespHeaderBufPos <= pReq->m_pRespHeaderBuf )
1653+
return 0;
1654+
16471655
LSAPI_FinalizeRespHeaders_r( pReq );
16481656
}
16491657
if ( pReq->m_pRespBufPos != pReq->m_pRespBuf )
16501658
{
16511659
Flush_RespBuf_r( pReq );
16521660
}
16531661

1654-
pReq->m_pIovecCur->iov_base = (void *)&finish;
1655-
pReq->m_pIovecCur->iov_len = LSAPI_PACKET_HEADER_LEN;
1656-
pReq->m_totalLen += LSAPI_PACKET_HEADER_LEN;
1662+
pReq->m_pIovecCur->iov_base = (void *)finish_close;
1663+
pReq->m_pIovecCur->iov_len = LSAPI_PACKET_HEADER_LEN << 1;
1664+
pReq->m_totalLen += LSAPI_PACKET_HEADER_LEN << 1;
16571665
++pReq->m_pIovecCur;
16581666
LSAPI_Flush_r( pReq );
1667+
lsapi_close_connection(pReq);
16591668
}
1660-
send_conn_close_notification(pReq->m_fd);
1661-
lsapi_close_connection(pReq);
16621669
pReq->m_reqState |= LSAPI_ST_BACKGROUND;
16631670
}
16641671
return 0;
@@ -3163,8 +3170,8 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer,
31633170

31643171
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
31653172
*s_avail_pages = sysconf(_SC_AVPHYS_PAGES);
3166-
lsapi_log("Memory total: %zd, free: %zd, free %%%zd\n",
3167-
s_total_pages, *s_avail_pages, *s_avail_pages * 100 / s_total_pages);
3173+
// lsapi_log("Memory total: %zd, free: %zd, free %%%zd\n",
3174+
// s_total_pages, *s_avail_pages, *s_avail_pages * 100 / s_total_pages);
31683175

31693176
#endif
31703177
FD_ZERO( &readfds );

0 commit comments

Comments
 (0)