diff options
author | SudhakarReddy <Sudhakar.reddy@amdocs.com> | 2018-03-29 13:06:07 +0530 |
---|---|---|
committer | SudhakarReddy <Sudhakar.reddy@amdocs.com> | 2018-03-29 14:24:22 +0530 |
commit | ff40a0cee1f8de73d8d764cc97495f6615c3d1eb (patch) | |
tree | d7ff1f4dac008df4ff24d6ec5f847bdacb148c2b | |
parent | 63bf19e9be7fe29fc691bef4088ec544444a4a19 (diff) |
removed OriginHeader method in Multipart view
Change-Id: I5ba662e052ddfbcce1247c2cc3b048ab9e64c50b
Issue-ID: MULTICLOUD-180
Signed-off-by: SudhakarReddy <Sudhakar.reddy@amdocs.com>
-rw-r--r-- | multivimbroker/multivimbroker/forwarder/views.py | 7 | ||||
-rw-r--r-- | multivimbroker/multivimbroker/pub/utils/restcall.py | 2 |
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()))) |