Hello,
Sorry for my late replay. Now I can be able to write file into disk and read from it without problem (csv file) by using this:
ngx_temp_file_t *tf;
tf = ngx_pcalloc(r->pool, sizeof (ngx_temp_file_t));
tf->file.fd = NGX_INVALID_FILE;
tf->file.log = nlog;
tf->path = clcf->client_body_temp_path;
tf->pool = r->pool;
tf->persistent = 1;
rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool, tf->persistent, tf->clean, tf->access);
//ngx_write_chain_to_file(&tf->file, bucket->first, bucket->content_length, r->pool);
ngx_write_chain_to_temp_file(tf, bucket->first);
I set persistent to 1 and I can read from it.
The problem is after reading file and processing it, I have to delete file manually.
How can file can be delete automatically just after sending nginx's chain to next filter.
Other question: I write chain into file in order to read from it again. is it possible to use nginx's chain as a file buffer?