コード例 #1
0
    def new_proxy_data(self, server):
        logging.debug("got new proxy data, processing")
        neg_done = False
        try:
            neg_done = server.negotiation_done()
        except (EOFError, IOError, socket.error):
            self.quit()
        if not neg_done:
            logging.debug("negotiation not yet done, skipping proxy data")
            return

        s = None
        try:
            s = server.read_very_lazy()
        except (EOFError, IOError, socket.error):
            self.quit()

        logging.debug("got data from proxy: %s\n" % string_dump(s))

        if not s:
            # Could be option data, or something else that gets eaten by
            # a lower level layer.
            return

        # echo back to server
        self.send_buffered(self.tc, s)
        while s:
            c = s[:100]
            s = s[100:]
            self.destination.write(c)

        self.destination.flush()
コード例 #2
0
ファイル: test.py プロジェクト: faxm0dem/vSPC.py
    def new_proxy_data(self, server):
        logging.debug("got new proxy data, processing")
        neg_done = False
        try:
            neg_done = server.negotiation_done()
        except (EOFError, IOError, socket.error):
            self.quit()
        if not neg_done:
            logging.debug("negotiation not yet done, skipping proxy data")
            return

        s = None
        try:
            s = server.read_very_lazy()
        except (EOFError, IOError, socket.error):
            self.quit()

        logging.debug("got data from proxy: %s\n" % string_dump(s))

        if not s:
            # Could be option data, or something else that gets eaten by
            # a lower level layer.
            return

        # echo back to server
        self.send_buffered(self.tc, s)
        while s:
            c = s[:100]
            s = s[100:]
            self.destination.write(c)

        self.destination.flush()
コード例 #3
0
ファイル: test.py プロジェクト: faxm0dem/vSPC.py
    def new_client_data(self, client):
        data = client.read()
        if CLIENT_ESCAPE_CHAR in data:
            loc = data.index(CLIENT_ESCAPE_CHAR)
            pre_data = data[:loc]
            post_data = data[loc+1:]
            data = pre_data + self.process_escape_character() + post_data

        logging.debug("got client data %s, sending to proxy" % string_dump(data))
        self.send_buffered(self.tc, data)
コード例 #4
0
    def new_client_data(self, client):
        data = client.read()
        if CLIENT_ESCAPE_CHAR in data:
            loc = data.index(CLIENT_ESCAPE_CHAR)
            pre_data = data[:loc]
            post_data = data[loc + 1:]
            data = pre_data + self.process_escape_character() + post_data

        logging.debug("got client data %s, sending to proxy" %
                      string_dump(data))
        self.send_buffered(self.tc, data)
コード例 #5
0
 def send_buffered(self, conn, data=''):
     logging.debug("sending data to proxy: %s" % string_dump(data))
     if conn.send_buffered(data):
         self.add_writer(conn, self.send_buffered)
     else:
         self.del_writer(conn)
コード例 #6
0
ファイル: test.py プロジェクト: faxm0dem/vSPC.py
 def send_buffered(self, conn, data = ''):
     logging.debug("sending data to proxy: %s" % string_dump(data))
     if conn.send_buffered(data):
         self.add_writer(conn, self.send_buffered)
     else:
         self.del_writer(conn)