mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00
Especially on FreeBSD it seems to be common that send(2) does not
do a decent job. We handle that better now.
This commit is contained in:
parent
6871b839b5
commit
ae92ebb92b
1 changed files with 15 additions and 6 deletions
|
@ -42,17 +42,26 @@ static php_thttpd_globals thttpd_globals;
|
||||||
static int sapi_thttpd_ub_write(const char *str, uint str_length)
|
static int sapi_thttpd_ub_write(const char *str, uint str_length)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
uint sent = 0;
|
||||||
TLS_FETCH();
|
TLS_FETCH();
|
||||||
|
|
||||||
n = send(TG(hc)->conn_fd, str, str_length, 0);
|
while (str_length > 0) {
|
||||||
|
n = send(TG(hc)->conn_fd, str, str_length, 0);
|
||||||
|
|
||||||
if (n == -1 && errno == EPIPE) {
|
if (n == -1 && errno == EPIPE)
|
||||||
php_handle_aborted_connection();
|
php_handle_aborted_connection();
|
||||||
|
if (n == -1 && errno == EAGAIN)
|
||||||
|
continue;
|
||||||
|
if (n <= 0)
|
||||||
|
return n;
|
||||||
|
|
||||||
|
TG(hc)->bytes += n;
|
||||||
|
str += n;
|
||||||
|
sent += n;
|
||||||
|
str_length -= n;
|
||||||
}
|
}
|
||||||
|
|
||||||
TG(hc)->bytes += n;
|
return sent;
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
|
static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue