summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--multivimbroker/multivimbroker/forwarder/views.py7
-rw-r--r--multivimbroker/multivimbroker/pub/utils/restcall.py2
2 files changed, 7 insertions, 2 deletions
diff --git a/multivimbroker/multivimbroker/forwarder/views.py b/multivimbroker/multivimbroker/forwarder/views.py
index a5dd22c..c66a6f1 100644
--- a/multivimbroker/multivimbroker/forwarder/views.py
+++ b/multivimbroker/multivimbroker/forwarder/views.py
@@ -15,6 +15,7 @@
import os
import json
+import re
import tempfile
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
@@ -177,8 +178,12 @@ class MultiPartView(BaseServer):
fileObj.file.close()
params[key] = open(f.name, 'rb')
datagen, headers = multipart_encode(params)
+ regex = re.compile('^HTTP_')
+ for key, value in request.META.iteritems():
+ if key.startswith("HTTP_"):
+ headers[regex.sub('', key).replace('_', '-')] = value
resp = self.send(vimid, request.path, datagen, "POST",
- headers=originHeaders(request))
+ headers=headers)
finally:
for key in params:
fileRef = params[key]
diff --git a/multivimbroker/multivimbroker/pub/utils/restcall.py b/multivimbroker/multivimbroker/pub/utils/restcall.py
index c839f61..046d77c 100644
--- a/multivimbroker/multivimbroker/pub/utils/restcall.py
+++ b/multivimbroker/multivimbroker/pub/utils/restcall.py
@@ -54,7 +54,7 @@ def call_multipart_req(base_url, user, passwd, auth_type, resource, method,
else:
ret = [1, resp.read(), resp.code, resp]
except urllib2.URLError as err:
- ret = [2, str(err), resp.code, resp]
+ ret = [2, str(err), 500, resp]
except Exception:
logger.error(traceback.format_exc())
logger.error("[%s]ret=%s" % (callid, str(sys.exc_info())))