I'm struggling to get curl and socat to play nicely together. The situation is the following:
- I post XML to login to a system.
- Return message contains authentication token.
- I post subsequent requests with the token. Caveat: if the connection is broken, the token expires, so I can't just use plain curl.
It works fine in PowerShell: https://pastebin.com/5Jiw1fct
However, I need this to run in Linux. Since I need the connection to persist, I decided to use socat.
If I run this to POST the XML:
curl http://$target_ip -d @./xml/login.xml
I get a proper answer from the system. But the connection is closed, so I can't re-use the token.
However, if I try this (of course, after socat):
curl --unix-socket /tmp/$target_ip.sock -d @./xml/login.xml
Curl complain I don't have the URL set.
Thanks as always.