chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 23 Mar 2017 19:17:27 +0000 (19:17 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 23 Mar 2017 19:17:27 +0000 (19:17 +0000)
fake-userv
server

index 24f6aad..0796412 100755 (executable)
@@ -5,6 +5,5 @@ exec 3<&0 4>&1 5>&2 >&2 </dev/null
 exec xterm -T netns -e unshare -n -- sh -xc '
   "$@" <&3 >&4 2>&5 &
   sleep 0.1
-  ping 192.0.2.1 &
   env - bash -i
 ' x "$@"
diff --git a/server b/server
index e3fef89..17dcd5d 100755 (executable)
--- a/server
+++ b/server
@@ -135,7 +135,13 @@ def process_request(request):
 class IphttpResource(twisted.web.resource.Resource):
   isLeaf = True
   def render_POST(self, request):
-    process_request(request)
+    try: process_request(request)
+    except Exception as e:
+      request.setHeader('Content-Type','text/plain; charset="utf-8"')
+      request.setResponseCode(400)
+      request.write(str(e).encode('utf-8'))
+      request.finish
+      
   def render_GET(self, request):
     return b'<html><body>hippotat</body></html>'