[Urgent]Fix the integration test failure casused by http header processing

1.What is the problem:
Python requests lib is used to forward the http request from the Cinder
API-GW to bottom Cinder. Now the latest version of the requests lib
add stricter header validity check: only bytes or string is allowed for
header item's value, other value will lead to exception, even for "None".
But Cinder client will pass some header items with "None" value in the
api request to Cinder API-GW, thus lead to the exception in Cinder API-GW
when forwarding the request to the bottom Cinder via requests lib, which
lead to the integration failed, and block any patch to be merged.

2.What's need to be fixed:
Remove(clean) the invalid header items in the request to the bottom
Cinder, in which the python requests lib is used. So that integration
test can pass, and make patch being able to be merged.

3.What is the purpose of this patch set:
Fix the integration test failure issue casued by strict validity check
in http header processing.

Change-Id: Iff6d2dd77571180ef9a0cad2171c479be63bd880
Signed-off-by: joehuang <joehuang@huawei.com>
joehuang 7 years ago
parent 8f3cd2e672
commit 0d0ca11e95

@ -249,9 +249,15 @@ class VolumeController(rest.RestController):
% pod['pod_name'])
# TODO(joehuang): convert header and body content
# TODO(joehuang): get the release of top and bottom
t_release = cons.R_MITAKA
b_release = cons.R_MITAKA
b_headers = hclient.convert_header(t_release,
resp = hclient.forward_req(context, 'GET',

@ -182,7 +182,17 @@ def get_res_routing_ref(context, _id, t_url, s_type):
def convert_header(from_release, to_release, header):
return header
b_header = {}
# remove invalid header item, requests lib will strictly check
# header for security purpose, non-string or non-bytes value
# will lead to exception, and leading space will also be removed
# by requests.util.check_header_validity function
for k, v in header.items():
if v:
b_header[k] = v
return b_header
def convert_object(from_release, to_release, res_object,