mirror of
https://github.com/apache/httpd.git
synced 2025-07-25 17:01:22 +00:00
handle large writes in ap_rputs
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1901500 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@ -501,7 +501,27 @@ AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
|
||||
*/
|
||||
static APR_INLINE int ap_rputs(const char *str, request_rec *r)
|
||||
{
|
||||
return ap_rwrite(str, (int)strlen(str), r);
|
||||
apr_size_t len;
|
||||
|
||||
len = strlen(str);
|
||||
|
||||
for (;;) {
|
||||
if (len <= INT_MAX) {
|
||||
return ap_rwrite(str, (int)len, r);
|
||||
}
|
||||
else {
|
||||
int rc;
|
||||
|
||||
rc = ap_rwrite(str, INT_MAX, r);
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
else {
|
||||
str += INT_MAX;
|
||||
len -= INT_MAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2064,6 +2064,9 @@ AP_DECLARE(int) ap_rputc(int c, request_rec *r)
|
||||
|
||||
AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r)
|
||||
{
|
||||
if (nbyte < 0)
|
||||
return -1;
|
||||
|
||||
if (r->connection->aborted)
|
||||
return -1;
|
||||
|
||||
|
Reference in New Issue
Block a user