How to get the subrequest response in custom module

Hi, Im trying to get the response from a subrequest. Im getting the callback correctly, the status is ok - but how do I read the response ?

ngx_int_t
ngx_http_foo_subrequest_done(ngx_http_request_t *r, void *data, ngx_int_t rc)
{
ngx_http_opg_auth_request_ctx_t *ctx = data;

ctx->done = 1;
ctx->status = r->headers_out.status;

return rc;

}

I can see the status but how can I access the reponse ? do I have to use ngx_http_read_client_request_body ?

Thank you

Moved to the "How Do I...?" category.

Hi we can close this one, after learning from http_auth_request I understand now how this can be used. Thank you.