[dev] how to read client body data

Manlio Perillo manlio_perillo at libero.it
Wed Aug 22 14:47:42 MSD 2007


Igor Sysoev ha scritto:
> [...]
>> The request->request_body->temp_file->file->fd handle is opened for read 
>> (and will be closed at request finalization)?
> 
> Yes. Do not forget to test
> 
>     if (r->request_body && r->request_body->temp_file) {
> 
> 

Ok, so I can do:

if (r->request_body) {
   if (r->request_body->temp_file) {
      /* all the request body is in a temporary file */
      fd = request_body->temp_file->file->fd;
      ... use the file descriptor for reading; no need to close it
   }
   else if (r->request_body->buf}
     /* all the request body is in a buffer */
   }
}

I'm right?



Thanks and regards  Manlio Perillo





More information about the nginx mailing list