def parse_and_record(self, method):
        urlp = urlparse.urlparse(self.path)
        query, data = urlparse.parse_qs(urlp.query), None
        if method in ('POST', 'PUT'):
            l = int(self.headers['Content-Length'])
            ct, params = cgi.parse_header(self.headers['Content-Type'])
            if ct == 'multipart/form-data':
                data = cgi.FieldStorage(fp=self.rfile, headers=self.headers, environ={'REQUEST_METHOD': 'POST'})
            else:
                data = urlparse.parse_qs(self.rfile.read(l))
        request = self.record(method, urlp.path, query=query, data=data)
        self.respond(request)
dataset/ETHPy150Open smartfile/client-python/tests.py/TestHTTPRequestHandler.parse_and_record/original