From bc5de8033ba88761edddd7202a97d46343f95b76 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Thu, 1 Jul 2010 11:12:01 -0400 Subject: [PATCH] Palm: Fix POST method --- palm/lib/child.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/palm/lib/child.py b/palm/lib/child.py index b4af381..c477f9b 100644 --- a/palm/lib/child.py +++ b/palm/lib/child.py @@ -145,10 +145,18 @@ class Child: opts = self.c['opts'] opts.append(request.resource) - #print "command:", bin, opts - os.dup2(remote.fileno(), sys.stdout.fileno()) - try: + os.dup2(remote.fileno(), sys.stdout.fileno()) + + # Write Post data to STDIN (Pipe) + if request.headers['REQUEST_METHOD'] == 'POST': + # Temporal Pipe > STDIN + pipe_r, pipe_w = os.pipe() + os.dup2(pipe_r, sys.stdin.fileno()) + + # Write POST content to Pipe + os.write(pipe_w, request.headers['POST_VARS']) + os.execve(bin, opts, request.headers) except: print "Content-Type: text/plain\r\n\r\n" -- 2.11.4.GIT