static void http_data_callback(lcb_http_request_t req, lcb_t instance, const void *cookie, lcb_error_t err, const lcb_http_resp_t *resp) { pycbc_HttpResult *htres = (pycbc_HttpResult*)cookie; htres->htcode = resp->v.v0.status; htres->rc = err; PYCBC_CONN_THR_END(htres->parent); get_headers(htres, resp); if (err != LCB_SUCCESS || resp->v.v0.status < 200 || resp->v.v0.status > 299) { PyObject *old_data = htres->http_data; lcbex_vrow_free(htres->rctx); htres->rctx = NULL; htres->http_data = PyList_New(0); if (old_data) { if (old_data != Py_None) { PyList_Append(htres->http_data, old_data); } Py_DECREF(old_data); } } if (htres->rctx) { lcbex_vrow_feed(htres->rctx, resp->v.v0.bytes, resp->v.v0.nbytes); } else if (resp->v.v0.bytes) { get_data(htres, resp->v.v0.bytes, resp->v.v0.nbytes); } if (!htres->parent->nremaining) { lcb_breakout(instance); } PYCBC_CONN_THR_BEGIN(htres->parent); (void)req; (void)instance; }
static void http_data_callback(lcb_http_request_t req, lcb_t instance, const void *cookie, lcb_error_t err, const lcb_http_resp_t *resp) { pycbc_HttpResult *htres = (pycbc_HttpResult*)cookie; htres->htcode = resp->v.v0.status; htres->rc = err; PYCBC_CONN_THR_END(htres->parent); get_headers(htres, resp); if (err != LCB_SUCCESS || resp->v.v0.status < 200 || resp->v.v0.status > 299) { lcbex_vrow_free(htres->rctx); htres->rctx = NULL; } if (htres->rctx) { lcbex_vrow_feed(htres->rctx, resp->v.v0.bytes, resp->v.v0.nbytes); maybe_invoke_async_callback(htres); } else if (resp->v.v0.bytes) { add_data(htres, resp->v.v0.bytes, resp->v.v0.nbytes); } if (!htres->parent->nremaining) { lcb_breakout(instance); } PYCBC_CONN_THR_BEGIN(htres->parent); (void)req; (void)instance; }