Commit 81a5e3f3 authored by valenok's avatar valenok

Added mg_send_file() to python binding

parent 29a38875
...@@ -39,6 +39,9 @@ def EventHandler(event, conn, info): ...@@ -39,6 +39,9 @@ def EventHandler(event, conn, info):
'<input type="submit"/>' '<input type="submit"/>'
'</form>') '</form>')
return True return True
elif event == mongoose.NEW_REQUEST and info.uri == '/secret':
conn.send_file('/etc/passwd')
return True
else: else:
return False return False
......
...@@ -110,6 +110,9 @@ class Connection(object): ...@@ -110,6 +110,9 @@ class Connection(object):
n = self.m.dll.mg_read(self.conn, buf, size) n = self.m.dll.mg_read(self.conn, buf, size)
return n <= 0 and None or buf[:n] 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): class Mongoose(object):
"""A wrapper class for Mongoose shared library.""" """A wrapper class for Mongoose shared library."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment