From: Ian Jackson Date: Sat, 1 Apr 2017 18:30:54 +0000 (+0100) Subject: wip X-Git-Tag: hippotat/1.0.0~55^2~179 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=hippotat.git;a=commitdiff_plain;h=e8fcf3b7494f214242f8a0a8fe9c72fe7f7a27b1 wip --- diff --git a/hippotat/__init__.py b/hippotat/__init__.py index d5da7dd..6286f49 100644 --- a/hippotat/__init__.py +++ b/hippotat/__init__.py @@ -44,10 +44,11 @@ _hex_codec = codecs.getencoder('hex_codec') log = twisted.logger.Logger() def log_debug(dflag, msg, idof=None, d=None): + #print('---------------->',repr((dflag, msg, idof, d)), file=sys.stderr) if idof is not None: msg = '[%d] %s' % (id(idof), msg) if d is not None: - d = d[0:64] + #d = d[0:64] d = _hex_codec(d)[0].decode('ascii') msg += ' ' + d log.info('{dflag} {msgcore}', dflag=dflag, msgcore=msg) diff --git a/hippotat/slip.py b/hippotat/slip.py index 7dbe316..f135137 100644 --- a/hippotat/slip.py +++ b/hippotat/slip.py @@ -27,7 +27,7 @@ def decode(data): #print('ESC... %o' % ck) if ck == esc_esc[0]: pdata += esc elif ck == esc_end[0]: pdata += end - else: raise ValueError('invalid SLIP escape') + else: raise ValueError('invalid SLIP escape 0%o %#x' % (ck, ck)) packet = packet[eix+2 : ] out.append(pdata) #print('DECODED ', repr(out)) diff --git a/server b/server index ab92be0..6a71bfd 100755 --- a/server +++ b/server @@ -73,7 +73,7 @@ class Client(): log_debug(dflag, ('client %s: ' % self._ip)+msg, **kwargs) def process_arriving_data(self, d): - self._log(DBG.FLOW, 'req data', d=d) + self._log(DBG.FLOW, "req data (enc'd)", d=d) if not len(d): return for packet in slip.decode(d): (saddr, daddr) = packet_addrs(packet) @@ -156,7 +156,7 @@ def process_request(request, desca): raise ValueError('tro must be %d' % cl.target_requests_outstanding) try: - d = request.args[b'd'] + d = request.args[b'd'][0] desca['d'] = d except KeyError: d = b''