From 81a5e3f3424c3b97e5be044a10561bf39ed8c68a Mon Sep 17 00:00:00 2001 From: valenok Date: Sun, 19 Jun 2011 18:03:38 +0100 Subject: [PATCH] Added mg_send_file() to python binding --- bindings/python/example.py | 3 +++ bindings/python/mongoose.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bindings/python/example.py b/bindings/python/example.py index d2a629bc..9c3f83ef 100644 --- a/bindings/python/example.py +++ b/bindings/python/example.py @@ -39,6 +39,9 @@ def EventHandler(event, conn, info): '' '') return True + elif event == mongoose.NEW_REQUEST and info.uri == '/secret': + conn.send_file('/etc/passwd') + return True else: return False diff --git a/bindings/python/mongoose.py b/bindings/python/mongoose.py index 1bd462fd..19a8ea71 100644 --- a/bindings/python/mongoose.py +++ b/bindings/python/mongoose.py @@ -110,6 +110,9 @@ class Connection(object): n = self.m.dll.mg_read(self.conn, buf, size) return n <= 0 and None or buf[:n] + def send_file(self, path): + self.m.dll.mg_send_file(self.conn, path) + class Mongoose(object): """A wrapper class for Mongoose shared library."""