mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
In core_output_filter(), reset nbytes to zero after calling
writev_it_all() in case we have another brigade to process. Otherwise, nbytes is bogus for the second brigade and writev_it_all() doesn't know when to quit (it loops). In writev_it_all(), when compensating for bytes already sent don't go beyond the number of iovs we were passed on input. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86391 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -2547,11 +2547,10 @@ static apr_status_t writev_it_all(apr_socket_t *s, struct iovec *vec, int nvec,
|
|||||||
if (bytes_written < len) {
|
if (bytes_written < len) {
|
||||||
/* Skip over the vectors that have already been written */
|
/* Skip over the vectors that have already been written */
|
||||||
apr_size_t cnt = vec[i].iov_len;
|
apr_size_t cnt = vec[i].iov_len;
|
||||||
while (n >= cnt) {
|
while (n >= cnt && i + 1 < nvec) {
|
||||||
i++;
|
i++;
|
||||||
cnt += vec[i].iov_len;
|
cnt += vec[i].iov_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n < cnt) {
|
if (n < cnt) {
|
||||||
/* Handle partial write of vec i */
|
/* Handle partial write of vec i */
|
||||||
vec[i].iov_base = (char *) vec[i].iov_base +
|
vec[i].iov_base = (char *) vec[i].iov_base +
|
||||||
@@ -3383,6 +3382,7 @@ static int core_output_filter(ap_filter_t *f, ap_bucket_brigade *b)
|
|||||||
rv = writev_it_all(r->connection->client->bsock,
|
rv = writev_it_all(r->connection->client->bsock,
|
||||||
vec, nvec,
|
vec, nvec,
|
||||||
nbytes, &bytes_sent);
|
nbytes, &bytes_sent);
|
||||||
|
nbytes = 0; /* in case more points to another brigade */
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_brigade_destroy(b);
|
ap_brigade_destroy(b);
|
||||||
|
Reference in New Issue
Block a user