sapi_lsapi_ub_write does not return bytes written in lsapi mode
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 90/100
Research direction
Open sapi/litespeed/lsapi_main.c and inspect sapi_lsapi_ub_write, then verify the return contract of LSAPI_Write. The fix is complete when lsapi mode reports the number of bytes actually written on a short write, while the existing abort handling remains intact.
Written by the indexing model from the issue text.
Description
Description
sapi/litespeed/lsapi_main.c:
static size_t sapi_lsapi_ub_write(const char *str, size_t str_length)
{
int ret;
int remain;
if ( lsapi_mode ) {
ret = LSAPI_Write( str, str_length );
if ( ret < str_length ) {
php_handle_aborted_connection();
return str_length - ret;
}
} else {
remain = str_length;
while( remain > 0 ) {
ret = write( 1, str, remain );
if ( ret <= 0 ) {
php_handle_aborted_connection();
return str_length - remain;
}
str += ret;
remain -= ret;
}
}
return str_length;
}
It seems to me that LSAPI_Write returns the number of bytes written. If this is less than the length of the string, something went wrong. But it then returns str_length - ret, where it should return ret.
PHP Version
master
Operating System
No response
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.2k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 112
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from php/php-src
-
Bug SAPI: cli_server Status: Verified
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Bug Status: Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Bug Status: Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Bug Category: Tests Status: Verified
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Bug SAPI: fpm Status: Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Similar issues
-
level/task module/gcp type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
hapostgres/pg_auto_failover#1190 ·
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
P3 sonic-vpp
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sonic-net/sonic-buildimage#29662 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
spack/spack-packages#6586 ·