Trying to extract string from curl redirected URL

Josh moonburntm at gmail.com
Sun Feb 10 14:12:02 UTC 2019


I have a website (say https://website.com) that I need to log in 
to, it will do a few 302 redirects and then I will end up with a 
unique session ID in the URL (such as 
https://website.com/welcome.html?s=636853677441448706). Is there 
some way of extracting this ID (I'll need it later for other 
things)?

I'm using std.net.curl's HTTP, and when I turn verbose on and do 
the login POST I can see that it is in fact redirecting to the 
URL with the session ID. I can see that etc.c.curl has 
CurlInfo.effective_url and CurlInfo.redirect_url that I can use 
with curl_easy_getinfo, but that needs a CURL*. 
HTTP.handle.handle is private, so I can't get a CURL* out of the 
Curl struct.

Is there something I'm missing? It it possible to access the 
private handle? Is there a better way to do what I'm trying to 
achieve?


More information about the Digitalmars-d-learn mailing list