2 messages in ru.sysoev.nginxupload module && wcgi module
FromSent OnAttachments
Valery KholodkovJul 29, 2008 10:08 am 
Manlio PerilloJul 29, 2008 10:57 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:upload module && wcgi moduleActions...
From:Valery Kholodkov (vale@public.gmane.org)
Date:Jul 29, 2008 10:08:49 am
List:ru.sysoev.nginx

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;