Specific example. There is a simple html form:
<form action="http://localhost:8000/submitPage" method="POST" enctype="multipart/form-data"> Login: <input name="Login" size="10"> <textarea name="Source" rows="20" style="width:560px"></textarea> <input type="SUBMIT" value="Отправить"> </form>
And you need to parse the transmitted values somehow. In numerous forums, people use cgi for such purposes:
class MyHandler(BaseHTTPRequestHandler): def do_POST(s): ctype, pdict = cgi.parse_header(s.headers.get('content-type')) if ctype == 'multipart/form-data': s.body = cgi.parse_multipart(s.rfile, pdict) #problem here ...
But going to parse_multipart everything hangs :(