Open jtraub91 opened 5 years ago
Hey @jtraub91, thanks for the report!
Could you put together a MCVE? I'm seeing some weird behavior, but your example doesn't look like the documentation - that should be cookies=True, cookie_jar='/cookies.txt')
, perhaps?
I'm actually seeing an error message, not just a simple failure - looks like the issue that I'm seeing though is that something is parsing the cookie value into a Python value (in this particular case, 'True' ->
True`).
Definitely some unexpected behavior, in either case.
@waynew Sure. Here it is (sensitive data hidden):
Via curl
$ curl -k -c ~/cookies.txt https://localhost -u username:password
...
$ cat ~/cookies.txt
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
localhost FALSE / FALSE 0 _xsrf x|xxxxxxx|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|xxxxxxxxxxx
Via salt.utils.http.query
:
>>> from salt.utils.http import query
>>> q = query('https://localhost', username=username, password=password, verify_ssl=False, cookies=True, cookie_jar='{}/cookies_salt.txt'.format(HOME_DIR))
>>> q
...
$ cat ~/cookies_salt.txt
#LWP-Cookies-2.0
Description of Issue
Cannot save cookies to file when using salt.utils.http.query Ex:
When specifying a cookie_jar the file will be opened but with no cookies inserted.
I believe the problem is stemming from a poor implementation of
save()
in future.backports.http.cookiejar library being used