Closed kopr12 closed 7 years ago
They are handled automatically, too:
https://github.com/benibela/internettools/blob/master/internet/internetaccess.pas#L129-L137
Or you can set a cookie header
Awesome, thanks !
Okay, no problem to set cookie header. But how can I view them ?
With the public functions, you cannot
You would need to read the protected array. It is not public, because I might change the cookie implementation
Something like cookies.SaveToFile / cookies.LoadFromFile would be great.
I did it manually with defaultinternet.lastHTTPHeaders.SaveToFile , to view them, and then set them later with defaultInternet.additionalHeaders.Text , and that works fine. Not a big problem but it would be nice to have that feature, simple to implement. I'm not sure if I should leave this issue open or close it, up to you I guess.
Great package overall btw, I'm really impressed. Thanks for providing it !
I have added a "TCookieManager" with SaveToFile/LoadFromFile methods.
Viewing individual cookies is not possible as there might be many cookies with the same name.
Nice, however I can't figure out how to work with that, maybe you can point me in the right direction. Let's take this for example :
var
res : string;
begin
res := httpRequest('https://youtube.com/');
defaultinternet.lastHTTPHeaders.SaveToFile('cookies.log');
end;
If you look at cookies.log you will see 3 cookies.
Can you please tell me how to save cookies with TCookieManager ? I tried several things but I always end up with empty file.
You do
defaultinternet.cookies.saveToFile('/tmp/cookies.log');
Working like a charm 👍
Don't know how I missed it, for some reason I was doing : cm: TCookieManager; cm.saveToFile... cm.parseHeadersForCookies... etc.
Thanks !
Are cookies implemented in internetaccess ? I can't seem to find it and I really miss that feature from synapse.
http://synapse.ararat.cz/doc/help/httpsend.THTTPSend.html#Cookies