nrd = ap_get_client_block(r, SvPVX(buffer)+offset, bufsiz);
while (bufsiz) { nrd = ap_get_client_block(r, SvPVX(buffer)+offset+total, bufsiz); if (nrd > 0) { total  += nrd; bufsiz -= nrd; } else if (nrd == 0) { break; } else {  ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "mod_perl: $r->read failed to read"); break; } }
static long mpxs_Apache__RequestRec_read(pTHX_ request_rec *r,                                         SV *buffer, int bufsiz,                                         int offset){    long nrd = 0;    int rc;    if ((rc = mpxs_setup_client_block(r)) != APR_SUCCESS) {        return 0;    }    if (mpxs_should_client_block(r)) {        /* ap_should_client_block() will return 0 if r->read_length */        mpxs_sv_grow(buffer, bufsiz+offset);        nrd = ap_get_client_block(r, SvPVX(buffer)+offset, bufsiz);    }    if (nrd > 0) {        mpxs_sv_cur_set(buffer, nrd+offset);        SvTAINTED_on(buffer);    }     else {        sv_setpvn(buffer, "", 0);    }    return nrd;}