Skip to content

Commit 90b27d5

Browse files
author
Ubuntu
committed
Make protocol string case insensitive
1 parent 3bf4273 commit 90b27d5

File tree

7 files changed

+9
-7
lines changed

7 files changed

+9
-7
lines changed

azure/http/httpclient.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,15 @@ def get_uri(self, request):
126126
''' Return the target uri for the request.'''
127127
protocol = request.protocol_override \
128128
if request.protocol_override else self.protocol
129+
protocol = protocol.lower()
129130
port = HTTP_PORT if protocol == 'http' else HTTPS_PORT
130131
return protocol + '://' + request.host + ':' + str(port) + request.path
131132

132133
def get_connection(self, request):
133134
''' Create connection for the request. '''
134135
protocol = request.protocol_override \
135136
if request.protocol_override else self.protocol
137+
protocol = protocol.lower()
136138
target_host = request.host
137139
target_port = HTTP_PORT if protocol == 'http' else HTTPS_PORT
138140

@@ -159,7 +161,7 @@ def get_connection(self, request):
159161
host = target_host
160162
port = target_port
161163

162-
if protocol == 'http':
164+
if protocol.lower() == 'http':
163165
connection = HTTPConnection(host, int(port),
164166
timeout=self.timeout)
165167
else:

azure/http/winhttp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def __init__(self, host, cert_file, protocol, timeout):
396396
self.host = unicode(host)
397397
self.cert_file = cert_file
398398
self._httprequest = _WinHttpRequest()
399-
self.protocol = protocol
399+
self.protocol = protocol.lower()
400400
self.timeout = timeout
401401
clsid = GUID('{2087C2F4-2CEF-4953-A8AB-66779B670495}')
402402
iid = GUID('{016FE2EC-B2C8-45F8-B23B-39E53A75396B}')

azure/storage/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ def __init__(self, connection_string = ''):
12971297

12981298
self.account_name = connection_params.get('AccountName', None)
12991299
self.account_key = connection_params.get('AccountKey', None)
1300-
self.protocol = connection_params.get('DefaultEndpointsProtocol', 'https')
1300+
self.protocol = connection_params.get('DefaultEndpointsProtocol', 'https').lower()
13011301
endpoint_suffix = connection_params.get('EndpointSuffix', None)
13021302
self.host_base_blob = BLOB_SERVICE_HOST_BASE if endpoint_suffix is None \
13031303
else ".blob.{}".format(endpoint_suffix)

azure/storage/blobservice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def __init__(self, account_name=None, account_key=None, protocol='https',
114114
connection_params = StorageConnectionParameters(connection_string)
115115
account_name = connection_params.account_name
116116
account_key = connection_params.account_key
117-
protocol = connection_params.protocol
117+
protocol = connection_params.protocol.lower()
118118
host_base = connection_params.host_base_blob
119119

120120
self._BLOB_MAX_DATA_SIZE = 64 * 1024 * 1024

azure/storage/queueservice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __init__(self, account_name=None, account_key=None, protocol='https',
9595
connection_params = StorageConnectionParameters(connection_string)
9696
account_name = connection_params.account_name
9797
account_key = connection_params.account_key
98-
protocol = connection_params.protocol
98+
protocol = connection_params.protocol.lower()
9999
host_base = connection_params.host_base_queue
100100

101101
super(QueueService, self).__init__(

azure/storage/storageclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, account_name=None, account_key=None, protocol='https',
6464
self.account_name = account_name
6565
self.account_key = account_key
6666
self.requestid = None
67-
self.protocol = protocol
67+
self.protocol = protocol.lower()
6868
self.host_base = host_base
6969
self.dev_host = dev_host
7070
self.sas_token = sas_token

azure/storage/tableservice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def __init__(self, account_name=None, account_key=None, protocol='https',
9393
connection_params = StorageConnectionParameters(connection_string)
9494
account_name = connection_params.account_name
9595
account_key = connection_params.account_key
96-
protocol = connection_params.protocol
96+
protocol = connection_params.protocol.lower()
9797
host_base = connection_params.host_base_table
9898

9999
super(TableService, self).__init__(

0 commit comments

Comments
 (0)