- if (conf->buffer_tree_given) {
- char *buf;
-
- if (btr_no_children(rn->btrn)) {
- t->error = -E_HTTP_RECV_NO_CHILD;
- goto err;
- }
- if (btr_bytes_pending(rn->btrn) > HTTP_RECV_MAX_PENDING) {
- t->error = -E_HTTP_RECV_OVERRUN;
- goto err;
- }
- buf = para_malloc(HTTP_RECV_READ_BUF_SIZE);
- t->error = recv_bin_buffer(phd->fd, buf, HTTP_RECV_READ_BUF_SIZE);
- if (t->error == 0)
- t->error = -E_RECV_EOF;
- if (t->error < 0) {
- free(buf);
- goto err;
- }
- btr_add_output(buf, t->error, rn->btrn);
- return;
- }
- t->error = -E_HTTP_RECV_OVERRUN;
- if (rn->loaded >= BUFSIZE)
- goto err;
- t->error = recv_bin_buffer(phd->fd, rn->buf + rn->loaded,
- BUFSIZE - rn->loaded);
- if (t->error == 0)
- t->error = -E_RECV_EOF;
- if (t->error < 0)
+ ret = -E_HTTP_RECV_OVERRUN;
+ sz = btr_pool_get_buffer(phd->btrp, &buf);
+ if (sz == 0)