mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
create the brigate outside ap_proxygetline and reuse it.
correct the overflow handling. (returning APR_ENOSPC was changing the behaviour). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@561778 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1184,20 +1184,20 @@ static int addit_dammit(void *v, const char *key, const char *val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
apr_status_t ap_proxygetline(char *s, int n, request_rec *r,
|
apr_status_t ap_proxygetline(apr_bucket_brigade *bb, char *s, int n, request_rec *r,
|
||||||
int fold, int *writen)
|
int fold, int *writen)
|
||||||
{
|
{
|
||||||
char *tmp_s = s;
|
char *tmp_s = s;
|
||||||
apr_status_t rv;
|
apr_status_t rv;
|
||||||
apr_size_t len;
|
apr_size_t len;
|
||||||
apr_bucket_brigade *tmp_bb;
|
|
||||||
|
|
||||||
tmp_bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
|
rv = ap_rgetline(&tmp_s, n, &len, r, fold, bb);
|
||||||
rv = ap_rgetline(&tmp_s, n, &len, r, fold, tmp_bb);
|
apr_brigade_cleanup(bb);
|
||||||
apr_brigade_destroy(tmp_bb);
|
|
||||||
|
|
||||||
if (rv == APR_SUCCESS) {
|
if (rv == APR_SUCCESS) {
|
||||||
*writen = (int) len;
|
*writen = (int) len;
|
||||||
|
} else if (rv == APR_ENOSPC) {
|
||||||
|
*writen = n;
|
||||||
} else {
|
} else {
|
||||||
*writen = -1;
|
*writen = -1;
|
||||||
}
|
}
|
||||||
@@ -1217,7 +1217,7 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
char keepchar;
|
char keepchar;
|
||||||
request_rec *rp;
|
request_rec *rp;
|
||||||
apr_bucket *e;
|
apr_bucket *e;
|
||||||
apr_bucket_brigade *bb;
|
apr_bucket_brigade *bb, *tmp_bb;
|
||||||
int len, backasswards;
|
int len, backasswards;
|
||||||
int interim_response; /* non-zero whilst interim 1xx responses
|
int interim_response; /* non-zero whilst interim 1xx responses
|
||||||
* are being read. */
|
* are being read. */
|
||||||
@@ -1236,15 +1236,16 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
* response.
|
* response.
|
||||||
*/
|
*/
|
||||||
rp->proxyreq = PROXYREQ_RESPONSE;
|
rp->proxyreq = PROXYREQ_RESPONSE;
|
||||||
|
tmp_bb = apr_brigade_create(p, c->bucket_alloc);
|
||||||
do {
|
do {
|
||||||
apr_status_t rc;
|
apr_status_t rc;
|
||||||
|
|
||||||
apr_brigade_cleanup(bb);
|
apr_brigade_cleanup(bb);
|
||||||
|
|
||||||
rc = ap_proxygetline(buffer, sizeof(buffer), rp, 0, &len);
|
rc = ap_proxygetline(tmp_bb, buffer, sizeof(buffer), rp, 0, &len);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
/* handle one potential stray CRLF */
|
/* handle one potential stray CRLF */
|
||||||
rc = ap_proxygetline(buffer, sizeof(buffer), rp, 0, &len);
|
rc = ap_proxygetline(tmp_bb, buffer, sizeof(buffer), rp, 0, &len);
|
||||||
}
|
}
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
|
||||||
|
Reference in New Issue
Block a user