/* 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);
"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);
/* 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")) {
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 */
/* 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);
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;
}