Sample Header Ad - 728x90

Posting to socket using curl

1 vote
1 answer
4807 views
I'm struggling to get curl and socat to play nicely together. The situation is the following: 1. I post XML to log in to a system. 2. The returned message contains an authentication token. 3. I post subsequent requests with the token. Caveat: if the connection is broken, the token expires, so I can't use plain curl. 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 reuse the token. However, if I try this (of course, after socat): curl --unix-socket /tmp/$target_ip.sock -d @./xml/login.xml Curl complains that I don't have the URL set.
Asked by Shiunbird (63 rep)
Jan 15, 2018, 03:34 PM
Last activity: Jun 5, 2025, 07:05 AM