git » pyweave » commit 3251978

Use network byte order for the whoisi responses

author Alberto Bertogli
2009-09-29 16:19:30 UTC
committer Alberto Bertogli
2009-09-29 16:21:44 UTC
parent ef26a241abe30e430feb9a9f94f27b98620bc2a0

Use network byte order for the whoisi responses

Thanks to Toby Elliott who confirmed that the integer is expected to be in
network byte order.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

pyweave.cgi +1 -3

diff --git a/pyweave.cgi b/pyweave.cgi
index eb021aa..937a38f 100755
--- a/pyweave.cgi
+++ b/pyweave.cgi
@@ -336,9 +336,7 @@ def output(obj, timestamp = None):
 		import struct
 		print "Content-type: application/whoisi"
 		print
-		# The spec doesn't specify the endianness of the integer, send
-		# it in host byte order. Note we assume o is a wbo.
-		sys.stdout.write(struct.pack('I', obj.id) + json.dumps(obj))
+		sys.stdout.write(struct.pack('!I', obj.id) + json.dumps(obj))
 	elif accept == 'application/newlines':
 		print "Content-type: application/newlines"
 		print