vfp_nop_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes) { ssize_t l, w; struct storage *st; while (bytes > 0) { st = FetchStorage(sp, 0); if (st == NULL) { htc->error = "Could not get storage"; return (-1); } l = st->space - st->len; if (l > bytes) l = bytes; w = HTC_Read(htc, st->ptr + st->len, l); if (w <= 0) return (w); st->len += w; sp->obj->len += w; bytes -= w; if (sp->wrk->do_stream) RES_StreamPoll(sp); } return (1); }
vfp_nop_begin(struct sess *sp, size_t estimate) { if (fetchfrag > 0) { estimate = fetchfrag; WSP(sp, SLT_Debug, "Fetch %d byte segments:", fetchfrag); } if (estimate > 0) (void)FetchStorage(sp, estimate); }
int VGZ_ObufStorage(struct busyobj *bo, struct vgz *vg) { struct storage *st; st = FetchStorage(bo, 0); if (st == NULL) return (-1); vg->st_obuf = st; VGZ_Obuf(vg, st->ptr + st->len, st->space - st->len); return (0); }
vfp_testgzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes) { struct vgz *vg; ssize_t l, wl; int i = -100; size_t dl; const void *dp; struct storage *st; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); vg = bo->vgz_rx; CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); AZ(vg->vz.avail_in); while (bytes > 0) { st = FetchStorage(bo, 0); if (st == NULL) return(-1); l = st->space - st->len; if (l > bytes) l = bytes; wl = HTC_Read(htc, st->ptr + st->len, l); if (wl <= 0) return (wl); bytes -= wl; VGZ_Ibuf(vg, st->ptr + st->len, wl); st->len += wl; bo->fetch_obj->len += wl; while (!VGZ_IbufEmpty(vg)) { VGZ_Obuf(vg, vg->m_buf, vg->m_sz); i = VGZ_Gunzip(vg, &dp, &dl); if (i == VGZ_END && !VGZ_IbufEmpty(vg)) return(FetchError(bo, "Junk after gzip data")); if (i != VGZ_OK && i != VGZ_END) return(FetchError2(bo, "Invalid Gzip data", vg->vz.msg)); } } assert(i == VGZ_OK || i == VGZ_END); return (1); }
vfp_esi_bytes_uu(struct sess *sp, struct http_conn *htc, ssize_t bytes) { ssize_t w; struct storage *st; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); while (bytes > 0) { st = FetchStorage(sp, 0); if (st == NULL) return (-1); w = vef_read(htc, st->ptr + st->len, st->space - st->len, bytes); if (w <= 0) return (w); VEP_parse(sp, (const char *)st->ptr + st->len, w); st->len += w; sp->obj->len += w; bytes -= w; } return (1); }
static int vfp_esi_bytes_uu(struct worker *wrk, struct http_conn *htc, ssize_t bytes) { ssize_t wl; struct storage *st; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); while (bytes > 0) { st = FetchStorage(wrk, 0); if (st == NULL) return (-1); wl = vef_read(wrk, htc, st->ptr + st->len, st->space - st->len, bytes); if (wl <= 0) return (wl); VEP_Parse(wrk, (const char *)st->ptr + st->len, wl); st->len += wl; wrk->busyobj->fetch_obj->len += wl; bytes -= wl; } return (1); }
vfp_nop_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes) { ssize_t l, wl; struct storage *st; AZ(wrk->busyobj->fetch_failed); while (bytes > 0) { st = FetchStorage(wrk, 0); if (st == NULL) return(-1); l = st->space - st->len; if (l > bytes) l = bytes; wl = HTC_Read(wrk, htc, st->ptr + st->len, l); if (wl <= 0) return (wl); st->len += wl; wrk->busyobj->fetch_obj->len += wl; bytes -= wl; if (wrk->busyobj->do_stream) RES_StreamPoll(wrk); } return (1); }
vfp_nop_begin(struct worker *wrk, size_t estimate) { if (estimate > 0) (void)FetchStorage(wrk, estimate); }