Safely read post body in http request handler?

时间:2018-09-18 20:28:01

标签: python http httpserver basehttprequesthandler

How do you safely read the post body of an HTTP POST request in a HTTP Request Handler in Python 3.+

I keep seeing solutions like the one here.

That solution only works if the request includes the content-length header and that header is accurate. Many times content-length gets excluded and is unreliable, any solution based on that is just frail. How do you return data from the rfile buffer without causing it hang by trying to read non existent bytes?

0 个答案:

没有答案