# HG changeset patch # User Matt Johnston # Date 1339808595 -28800 # Node ID ba9bfcc9c5260bb733f19b659e26a4373e4eb939 # Parent 3baca8d980f44885906c3034859bee19a79a09b7 - fix mac/urllib to work - don't sent 'START' line diff -r 3baca8d980f4 -r ba9bfcc9c526 server/ts.py --- a/server/ts.py Fri Jun 15 23:36:41 2012 +0800 +++ b/server/ts.py Sat Jun 16 09:03:15 2012 +0800 @@ -19,6 +19,8 @@ import binascii import hmac import zlib +import urllib +import urllib2 import config @@ -57,7 +59,6 @@ print>>sys.stderr, "Bad expected START line '%s'\n" % l.rstrip('\n') return None crc = crc16(l, crc) - lines.append(l) while True: l = readline(sock) @@ -122,9 +123,9 @@ def send_results(lines): enc_lines = binascii.b2a_base64(zlib.compress('\n'.join(lines))) - hmac.new(config.HMAC_KEY, enc_lines).hexdigest() + mac = hmac.new(config.HMAC_KEY, enc_lines).hexdigest() - url_data = urllib.url_encode( ('lines', enc_lines), ('hmac', mac) ) + url_data = urllib.urlencode( {'lines': enc_lines, 'hmac': mac} ) con = urllib2.urlopen(config.UPDATE_URL, url_data) result = con.read(100) if result == 'OK':