BaseHTTPRequestHandler parse_request() never returns

703 views Asked by At

I'm totally new to Python and trying to create a sublime plugin that needs a WebSocket server. I found this and tried to port it to Python 3 (originally written in 2?) and run into a problem with the following code:

class HTTPRequest(http.server.BaseHTTPRequestHandler):
   def __init__(self, request_text):
      self.rfile = StringIO(request_text)
      self.raw_requestline = self.rfile.readline()
      self.error_code = self.error_message = None
      print('before')
      self.parse_request()
      print('after') # never reached!

Taken from here.

The parse_reqeust() method never returns. The 'after' is never printed. Could someone point me in the right direction for how to debug things like this in Python?

(The technique above seems to come from this SO post)

0

There are 0 answers