Greetings!
Attached patch prevents corruption of resulting request body when using
upload module with wcgi module.
The parent changeset for this patch is 258 of mod_wcgi:
http://hg.mperillo.ath.cx/nginx/mod_wsgi/log/258
--
Regards,
Valery Kholodkov
--- src/ngx_wsgi.c 2008-03-26 20:35:15.000000000 +0100
+++ ../mod_wsgi-8994b058d2db-mine/src/ngx_wsgi.c 2008-07-27 15:35:37.000000000
+0200
@@ -97,6 +97,31 @@
return PyFile_FromString(filename, "r");
}
+ else if (r->request_body->bufs) {
+ /* Request body is in a chain */
+ ngx_chain_t *cl;
+ ngx_str_t body;
+ u_char *p;
+
+ body.len = 0;
+
+ for(cl = r->request_body->bufs ; cl ; cl = cl->next)
+ body.len += (cl->buf->last - cl->buf->pos);
+
+ body.data = ngx_palloc(r->pool, body.len);
+
+ if (body.data == NULL) {
+ return PyErr_NoMemory();
+ }
+
+ p = body.data;
+
+ for(cl = r->request_body->bufs ; cl ; cl = cl->next)
+ p = ngx_cpymem(p, cl->buf->pos, cl->buf->last - cl->buf->pos);
+
+ return cStringIO_New((char *)body.data, body.len,
+ r->connection->log);
+ }
else if (r->request_body->buf) {
/* All the request body is in a buffer */
ngx_uint_t size;