From 4619c1a71ef7ad2758ebacef278726666b31a04e Mon Sep 17 00:00:00 2001 From: valenok Date: Wed, 16 Mar 2011 21:35:07 +0000 Subject: [PATCH] Fixing http://code.google.com/p/mongoose/issues/detail?id=237 --- bindings/python/mongoose.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bindings/python/mongoose.py b/bindings/python/mongoose.py index cf1cafd2..1bd462fd 100644 --- a/bindings/python/mongoose.py +++ b/bindings/python/mongoose.py @@ -57,6 +57,7 @@ class mg_header(ctypes.Structure): class mg_request_info(ctypes.Structure): """A wrapper for struct mg_request_info.""" _fields_ = [ + ('user_data', ctypes.c_char_p), ('request_method', ctypes.c_char_p), ('uri', ctypes.c_char_p), ('http_version', ctypes.c_char_p), @@ -91,11 +92,11 @@ class Connection(object): return ctypes.c_char_p(val).value def get_var(self, data, name): - size = len(data) + size = data and len(data) or 0 buf = ctypes.create_string_buffer(size) n = self.m.dll.mg_get_var(data, size, name, buf, size) return n >= 0 and buf or None - + def printf(self, fmt, *args): val = self.m.dll.mg_printf(self.conn, fmt, *args) return ctypes.c_int(val).value