<div dir="ltr">Try to update Unit to version 0.4 first</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jan 22, 2018 at 2:56 PM Fedor Potapov <<a href="mailto:f.potapov18@yandex.ru">f.potapov18@yandex.ru</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hello,</div><div> </div><div>I'm trying to learn nginx unit. GET queries work fine, thanks to examples.</div><div>Nevertheless, when I try to process a POST, I get:</div><div> </div><div>--</div><div>ERROR:root:The client disconnected while sending the body (12 more bytes were expected)</div><div>Traceback (most recent call last):</div><div> File "/usr/local/lib/python2.7/site-packages/webapp2.py", line 1535, in __call__</div><div> rv = self.handle_exception(request, response, e)</div><div> File "/usr/local/lib/python2.7/site-packages/webapp2.py", line 1529, in __call__</div><div> rv = self.router.dispatch(request, response)</div><div> File "/usr/local/lib/python2.7/site-packages/webapp2.py", line 1278, in default_dispatcher</div><div> return route.handler_adapter(request, response)</div><div> File "/usr/local/lib/python2.7/site-packages/webapp2.py", line 1102, in __call__</div><div> return handler.dispatch()</div><div> File "/usr/local/lib/python2.7/site-packages/webapp2.py", line 572, in dispatch</div><div> return self.handle_exception(e, self.app.debug)</div><div> File "/usr/local/lib/python2.7/site-packages/webapp2.py", line 570, in dispatch</div><div> return method(*args, **kwargs)</div><div> File "/usr/local/www/unit/py/wsgi.py", line 24, in post</div><div> self.response.out.write(self.request.get('content'))</div><div> File "/usr/local/lib/python2.7/site-packages/webapp2.py", line 175, in get</div><div> param_value = self.get_all(argument_name)</div><div> File "/usr/local/lib/python2.7/site-packages/webapp2.py", line 212, in get_all</div><div> param_value = self.params.getall(argument_name)</div><div> File "/usr/local/lib/python2.7/site-packages/webob/request.py", line 851, in params</div><div> params = NestedMultiDict(self.GET, self.POST)</div><div> File "/usr/local/lib/python2.7/site-packages/webob/request.py", line 787, in POST</div><div> self.make_body_seekable()</div><div> File "/usr/local/lib/python2.7/site-packages/webob/request.py", line 941, in make_body_seekable</div><div> self.copy_body()</div><div> File "/usr/local/lib/python2.7/site-packages/webob/request.py", line 965, in copy_body</div><div> data = input.read(min(todo, 65535))</div><div> File "/usr/local/lib/python2.7/site-packages/webob/request.py", line 1557, in readinto</div><div> "(%d more bytes were expected)" % (self.remaining,)</div><div>DisconnectionError: The client disconnected while sending the body (12 more bytes were expected)</div><div>--</div><div> </div><div> </div><div>My sample code:</div><div>--</div><div>#!/usr/bin/env python</div><div> </div><div>import atexit, webapp2</div><div> </div><div>def cleanup():</div><div> print('Cleanup done.')</div><div>atexit.register(cleanup)</div><div> </div><div>class Forms(webapp2.RequestHandler):</div><div> def get(self):</div><div> self.response.write("""</div><div> <html></div><div> <body></div><div> <form action="/sign" method="post"></div><div> <div><textarea name="content" rows="3" cols="60"></textarea></div></div><div> <div><input type="submit" value="Sign"></div></div><div> </form></div><div> </body></div><div> </html>""")</div><div> </div><div>class Sign(webapp2.RequestHandler):</div><div> def post(self):</div><div> self.response.out.write('<html><body>You wrote:<pre>')</div><div> self.response.out.write(self.request.get('content'))</div><div> self.response.out.write('</pre></body></html>')</div><div> </div><div>application = webapp2.WSGIApplication([</div><div> (r'/', Forms),</div><div> (r'/sign', Sign),</div><div>])</div><div>--</div><div> </div><div>I'm assuming that the unitd drop connection before request.get and unitd does not know anything about the need to process POST here. How to correctly process POST here? Any timeout's ro read data upon POST ? Thank you.</div><div> </div><div>Env: Python 2.7, Unit-0.3, FreeBSD 11.1</div><div> </div></div>_______________________________________________<br>
unit mailing list<br>
<a href="mailto:unit@nginx.org" target="_blank">unit@nginx.org</a><br>
<a href="https://mailman.nginx.org/mailman/listinfo/unit" rel="noreferrer" target="_blank">https://mailman.nginx.org/mailman/listinfo/unit</a></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><p dir="ltr">С уважением,<br>
Красовский Влад.</p>
</div>