-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
Is your feature request related to a problem?
No response
Describe the solution you'd like
Ability to pass unsafe cookies (host name is IP address) to request() method of ClientSession. This was possible in A prior version before they started getting filtered out in the internal _request() method
morsal = Morsel()
morsal.update(
dict(
key='key',
value='********'
)
)
client_session.request(
"POST",
"http://10.*.*.*:8000/api/v1/",
cookies={
"key": morsal
},
cookies_unsafe=True
)The relevant lines that would need to be updated are in (refering to v. 3.13.3) client.py ClientSession._request() method lines 682 to 691.
all_cookies = self._cookie_jar.filter_cookies(url)
if cookies is not None:
tmp_cookie_jar = CookieJar(
quote_cookie=self._cookie_jar.quote_cookie
)
tmp_cookie_jar.update_cookies(cookies)
req_cookies = tmp_cookie_jar.filter_cookies(url)
if req_cookies:
all_cookies.load(req_cookies)
update to
all_cookies = self._cookie_jar.filter_cookies(url)
if cookies is not None:
tmp_cookie_jar = CookieJar(
quote_cookie=self._cookie_jar.quote_cookie,
unsafe=cookies_unsafe
)
tmp_cookie_jar.update_cookies(cookies)
req_cookies = tmp_cookie_jar.filter_cookies(url)
if req_cookies:
all_cookies.load(req_cookies)Describe alternatives you've considered
There are no viable alternatives as I cannot maintain a global cookie jar with unsafe set to true within the infrastructure I am working in.
Related component
Client
Additional context
No response
Code of Conduct
- I agree to follow the aio-libs Code of Conduct
Reactions are currently unavailable