blob: b3793bc8faf2d10facf5b9b2082b3062cf4c843d [file] [log] [blame]
ZhiQiang Fan39f97222013-09-20 04:49:44 +08001# Copyright 2013 OpenStack Foundation
Mate Lakat23a58a32013-08-23 02:06:22 +01002# Copyright 2013 Citrix Systems, Inc.
3# All Rights Reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16
17import httplib2
18
19
20class ClosingHttp(httplib2.Http):
21 def request(self, *args, **kwargs):
22 original_headers = kwargs.get('headers', {})
23 new_headers = dict(original_headers, connection='close')
24 new_kwargs = dict(kwargs, headers=new_headers)
25 return super(ClosingHttp, self).request(*args, **new_kwargs)