We can get connection from FS now
authorStas Shtin <antisvin@gmail.com>
Wed, 14 Apr 2010 19:16:22 +0000 (23:16 +0400)
committerStas Shtin <antisvin@gmail.com>
Wed, 14 Apr 2010 19:16:22 +0000 (23:16 +0400)
src/ipypbx/http.py

index 68b1234..fe288f0 100644 (file)
@@ -74,6 +74,8 @@ class FreeswitchConfigServer(QtNetwork.QTcpServer):
     def receiveData(self):
         while self.socket.canReadLine():
             line = str(self.socket.readLine()).strip()
+            print '<', line
+            self.httpRequestParser.handle(line)
             
 
 class HttpParseError(Exception):
@@ -91,6 +93,7 @@ class HttpRequestParser(object):
     
     def __init__(self):
         super(HttpRequestParser, self).__init__()
+        self.reset()
 
     def reset(self):
         """
@@ -103,13 +106,13 @@ class HttpRequestParser(object):
         self.message = ''
         
         # Set initial state.
-        self.state = HTTP_NONE        
+        self.state = self.HTTP_NONE        
 
     def handle(self, line):
         """
         Dispatch line to current state handler.
         """
-        for state in HTTP_STATES:
+        for state in self.HTTP_STATES:
             if getattr(self, 'HTTP_%s' % state) == self.state:
                 getattr(self, 'handle%s' % state.title())(line)
                 break