summaryrefslogtreecommitdiff
path: root/distbuild-helper
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-04-03 16:19:48 (GMT)
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-04-11 13:54:08 (GMT)
commit41dc6186316d4def134440c3ccad8e8ae83079bf (patch)
tree8f2cd187d0674c78f4b8741ae4f945116428a3fa /distbuild-helper
parent76416ad10cf39aa4f6d5d9ed339a103f5b85b3ae (diff)
downloadmorph-41dc6186316d4def134440c3ccad8e8ae83079bf.tar.gz
Request has headers and body. Allow POST method
Diffstat (limited to 'distbuild-helper')
-rwxr-xr-xdistbuild-helper10
1 files changed, 8 insertions, 2 deletions
diff --git a/distbuild-helper b/distbuild-helper
index 7399fb5..2aee822 100755
--- a/distbuild-helper
+++ b/distbuild-helper
@@ -155,7 +155,9 @@ class HelperMachine(distbuild.StateMachine):
url = msg['url']
method = msg['method']
- assert method in ('HEAD', 'GET')
+ headers = msg['headers']
+ body = msg['body']
+ assert method in ('HEAD', 'GET', 'POST')
logging.debug('JsonMachine: http request: %s %s' % (method, url))
@@ -166,7 +168,11 @@ class HelperMachine(distbuild.StateMachine):
try:
conn = httplib.HTTPConnection(netloc)
- conn.request(method, path)
+
+ if headers:
+ conn.request(method, path, body, headers)
+ else:
+ conn.request(method, path, body)
except (socket.error, httplib.HTTPException), e:
status = 418 # teapot
data = str(e)