> I did encounter same problem recently. I have inspected how it works, and
> eventually understand why it goes wrong. It's not a bug of webob, it's a
> bug
> of uWSGI. I did write a simple wsgi app to reproduce the issue,
>
> def application(environ, start_response):
>     input = environ['wsgi.input']
>     while True:
>         line = input.readline()
>         if not line:
>             break
>         print repr(line)
>
> run it with uwsgi and submit a multipart/form-data from. Following lines
> are
> the output
>
> '-----------------------------256672629917035\r'
> 'Content-Disposition: form-data; name="title"\r\n'
> '\r\n'
>
>

Another thing, are you sure this line is not from the very end of the
output ? (i am testing for the first line)

If it is so, it is normal to have it not ending with \n if the buffer is
not big enough to hold a line.

As i have wrote to Ian, the readline() in webob use a 64k buffer, so if i
send a 64k+1 sequence of 0, the check will fail again. uWSGI uses 1k
buffer for lines, this violates the webob expectations as well as a 64k
buffer.

IMHO the check for \n should be avoided, as the python specs says that if
you pass a hint to readline() you have to not rely on \n at the end.

If webob removes the hint, uWSGI will fail again (too little buffer) but
you will ends allocating an enormous memory chunks (think about a 2gb file
full of 0).

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to