unsigned int len = cache_ptr->hdrs_len + cache_ptr->data_len - appctx->ctx.cache.sent;
ret = htx_cache_dump_data(appctx, res_htx, HTX_BLK_DATA, len);
- if (!ret) {
+ total += ret;
+ res_htx->extra = (len - ret);
+ if (ret < len) {
si_rx_room_blk(si);
goto out;
}
- total += ret;
if (cache_ptr->hdrs_len + cache_ptr->data_len == appctx->ctx.cache.sent) {
if (first->len > sizeof(*cache_ptr) + appctx->ctx.cache.sent) {
/* Headers and all data have been sent
unsigned int len = first->len - sizeof(*cache_ptr) - appctx->ctx.cache.sent;
ret = htx_cache_dump_data(appctx, res_htx, HTX_BLK_TLR, len);
- if (!ret) {
+ if (ret < len) {
si_rx_room_blk(si);
goto out;
}
}
}
out:
- if (total) {
- res->total += total;
- res->flags |= CF_READ_PARTIAL;
- }
+ if (total)
+ channel_add_input(res, total);
/* we have left the request in the buffer for the case where we
* process a POST, and this automatically re-enables activity on
/* buffer are aligned there, should be fine */
if (appctx->st0 == HTTP_CACHE_HEADER || appctx->st0 == HTTP_CACHE_INIT) {
int len = first->len - *sent - sizeof(struct cache_entry);
-
if (len > 0) {
int ret;
if (appctx->st0 == HTTP_CACHE_INIT && *sent > cache_ptr->eoh &&
cache_channel_append_age_header(cache_ptr, res))
appctx->st0 = HTTP_CACHE_HEADER;
+ else if (ret == len) {
+ *sent = 0;
+ appctx->st0 = HTTP_CACHE_FWD;
+ }
}
else {
*sent = 0;