Skip to content

Commit 9bee88c

Browse files
committed
fix: use the correct field for host matching
Signed-off-by: Norbert Biczo <[email protected]>
1 parent ef1f6b5 commit 9bee88c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: ibm_cloud_sdk_core/base_service.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,13 @@ def send(self, request: requests.Request, **kwargs) -> DetailedResponse:
335335
None, response.url, reason=f'reached the maximum number of redirects: {MAX_REDIRECTS}'
336336
)
337337

338-
# urllib3 has already prepared a request that can almost be used as-is.
338+
# The `requests` package has already prepared a request that can almost be used as-is.
339339
next_request = response.next
340340

341-
from_domain = urlparse(response.request.url).netloc
342-
to_domain = urlparse(next_request.url).netloc
343-
same_host = from_domain == to_domain
344-
safe_domain = from_domain.endswith('.cloud.ibm.com') and to_domain.endswith('.cloud.ibm.com')
341+
from_host = urlparse(response.request.url).hostname
342+
to_host = urlparse(next_request.url).hostname
343+
same_host = from_host == to_host
344+
safe_domain = from_host.endswith('.cloud.ibm.com') and to_host.endswith('.cloud.ibm.com')
345345

346346
# If both the original and the redirected URL are under the `.cloud.ibm.com` domain,
347347
# copy the safe headers that are used for authentication purposes,

0 commit comments

Comments
 (0)