Welcome! Log In Create A New Profile

Advanced

Re: [nginx module] Save response into temp file

October 09, 2014 07:10AM
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?
Subject Author Posted

[nginx module] Save response into temp file

Hung Nguyen September 23, 2014 04:12AM

Re: [nginx module] Save response into temp file

hungnguyen September 24, 2014 05:03AM

Re: [nginx module] Save response into temp file

wandenberg September 24, 2014 08:36AM

Re: [nginx module] Save response into temp file

hungnguyen October 09, 2014 07:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 56
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready