[fpc-pascal] Using fphttpclient to simulate web action sequence

leledumbo leledumbo_cool at yahoo.co.id
Thu Apr 30 20:35:03 CEST 2015

> Just extract the and save the value of the Set-Cookie header ? 
> I always store the cookies explicitly. 

If that's so, the current Cookies property implementation seems broken. I
try to debug and indeed I found that each Set-Cookie line overrides the
previous if there are more than one Set-Cookie (procedure DoCookies,
FCookies gets cleared at the start).

I try to log Cookies.Text, and for instance:

Set-Cookie: cart_code=f654373c175ac6e86da22c7400a146f0; expires=Fri,
29-Apr-2016 16:40:05 GMT; path=/ 

results in:
expires=Fri, 29-Apr-2016 16:40:05 GMT

which is not right since expires and path are cookie attributes instead of
cookie value (I even wonder if TStrings is the right choice to store
cookies). Guess I'll have to use Free + re-Create + search and parse
Set-Cookie manually then.

> We can think of a "TCookieJar" class implementation as an option

I guess so, but it's better integrated in fphttpclient so it can act as a
true browser session instead of just a one time request caller.

> It must

It actually does, but actually one can't prove that by inspecting
RequestHeaders.Text BEFORE doing http method, because Cookies gets merged
there DURING the http method.

> I have plans to handle this in TFPHTTPClient

I didn't ask if 302 is a problem, it's a statement that 302 is expected and
is OK. Does what you say indicates that probably the cause of the stuck

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Using-fphttpclient-to-simulate-web-action-sequence-tp5721642p5721648.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.

More information about the fpc-pascal mailing list