Commit 589f2db2 authored by Graham Leggett's avatar Graham Leggett
Browse files

Apply changes to ap_get_brigade() to the proxy code.

PR:
Obtained from:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88922 13f79535-47bb-0310-9956-ffa450edef68
parent 57560aac
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -1561,9 +1561,6 @@ PROXY_DECLARE (int) ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf
    /* send response */
    r->sent_bodyct = 1;

    /* read till EOF */
    c->remain = -1;

    if (parms[0] == 'd') {
	/* insert directory filter */
	ap_add_output_filter("PROXY_SEND_DIR", NULL, r, r->connection);
@@ -1576,7 +1573,7 @@ PROXY_DECLARE (int) ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf
		     "proxy: FTP: start body send");

	/* read the body, pass it to the output filters */
	while (ap_get_brigade(remote->input_filters, bb, AP_MODE_BLOCKING) == APR_SUCCESS) {
	while (ap_get_brigade(remote->input_filters, bb, AP_MODE_BLOCKING, -1) == APR_SUCCESS) {
	    if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
		e = apr_bucket_flush_create();
		APR_BRIGADE_INSERT_TAIL(bb, e);
+5 −3
Original line number Diff line number Diff line
@@ -744,6 +744,7 @@ PROXY_DECLARE (int) ap_proxy_http_handler(request_rec *r, proxy_server_conf *con
    /* send body */
    if (!r->header_only) {
	const char *buf;
	apr_size_t remain;

	/* if chunked - insert DECHUNK filter */
	if (ap_proxy_liststr((buf = apr_table_get(r->headers_out, "Transfer-Encoding")), "chunked")) {
@@ -753,11 +754,12 @@ PROXY_DECLARE (int) ap_proxy_http_handler(request_rec *r, proxy_server_conf *con
		apr_table_set(r->headers_out, "Transfer-Encoding", buf);
	    }
	    ap_add_input_filter("DECHUNK", NULL, rp, origin);
	    remain = -1;
	}

	/* if content length - set the length to read */
	else if ((buf = apr_table_get(r->headers_out, "Content-Length"))) {
	    origin->remain = atol(buf);
	    remain = atol(buf);
	}

	/* no chunked / no length therefore read till EOF and cancel keepalive */
@@ -767,14 +769,14 @@ PROXY_DECLARE (int) ap_proxy_http_handler(request_rec *r, proxy_server_conf *con

	/* if keepalive cancelled, read to EOF */
	if (close) {
	    origin->remain = -1;
	    remain = -1;
	}

	ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
		     "proxy: start body send");

	/* read the body, pass it to the output filters */
	while (ap_get_brigade(rp->input_filters, bb, AP_MODE_BLOCKING) == APR_SUCCESS) {
	while (ap_get_brigade(rp->input_filters, bb, AP_MODE_BLOCKING, remain) == APR_SUCCESS) {
	    if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
		e = apr_bucket_flush_create();
		APR_BRIGADE_INSERT_TAIL(bb, e);
+2 −5
Original line number Diff line number Diff line
@@ -1096,14 +1096,11 @@ apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb,
    buff[0] = 0;
    *eos = 0;

    /* get line-at-a-time */
    c->remain = 0;

    /* loop through each brigade */
    while (!found) {

	/* get brigade from network */
	if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, AP_MODE_BLOCKING))) {
	/* get brigade from network one line at a time */
	if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, AP_MODE_BLOCKING, 0))) {
	    return rv;
	}