sending data in "chunks"

Manlio Perillo manlio_perillo at
Sun Sep 16 21:36:49 MSD 2007


I need to send to the client some data in chunks.
The data is read from a Python file like object.

Right now I'm using a static ngx_chain_t variable, and for each cycle I 
read data from the "file" object in a buffer and do:

  // allocate buf and b
  out.buf = b; = NULL;

  b->pos = buf;
  b->last = buf + n;

  b->memory = 1;
  b->last_buf = 0;

  rc = ngx_http_output_filter(r, &out);
  if (rc != NGX_OK) {
    goto error;

Then at the end of the cycle, then, I do a

  return ngx_http_output_filter(r, NULL);

Unfortunately this does not works.
What is the right method for sending data in chunks?

Thanks   Manlio Perillo

More information about the nginx mailing list