Now let's get back to your demo HttpTst and let's ask some questions
again;)
1. You said: You can use any storage method you like to save the cookie.
- I don't
need to save this cookie on a disc because I don't need it after the
session is closed so
any other method to do this would be great (can you please write a really
simple code how to
do this because I am quite new to it? :(
Yes, you don't have to store the cookie on disk. But you may if you like :-)
Cookies are just simple strings. You can store them into a simple
TStringList. Or you can parse them when received and save the parsed values
to a record or an object and use a TList or TObjectList to keep a list of
those items for later use when sending more requests.
2. How should it be done to simulate clicking a link?
Clicking on a link is simple getting the URL specified by the link. You
use the Get or GetAsync method of the component. You must also search your
cookie store to find any applicable cookie for the URL you are getting.
The idea is simple - it must be
the same session - so how to keep the session alive after opening the
first URL?
HTTP is sessionless. That's why cookies has been created. That is the cookie
which maintain what we could call a session. The server send a cookie and
the browser send it back with the next request (related to the path
specified in the cookie). So the server know it is the same session.
And how to open the next URL in the same session? Or maybe the session is
alive all the time till I
close the HttpTst program? What's the answer?
The session is alive from the time you grab the cookie and as long as you
send the cookie(s) along with any subsequent requests, no matter if the TCP
session use for HTTP transport or you quit your program. The session live is
only depending on the cookie being sent. Some server program doesn't enforce
cookie expiration (that is they rely on the browser to stop sending an
expired cookie), other also maintain an expiration date/time at server side
(Better because someone can easily hack cookies).
The server has no wayt to know that you quite your program or not. HTTP
protocol specify that several request can be sent thru separate TCP
sessions. IE use several TCP sessions simultaneously to speed up page
loading (a web page is frequently a lot of requests).
3. Forgive me please my nooblike questions but I am quite new to the
subject
and sure would like to learn more;)
You're welcome.
--
[EMAIL PROTECTED]
http://www.overbyte.be
- Original Message -
From: Julian S. [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Saturday, June 11, 2005 12:35 PM
Subject: [twsocket] Re: Re: 2 questions concerning cookies (Francois PIETTE)
Mayby I should describe the problem better.
(at the moment taking about using ordinary browser like IE)
The situation is like this. I open an URL
(http://blablabla.site.pl/?we=airstriker) which provides me with one and
only one
simple cookie which is generated by php script and looks like this:
cookie_kod=773321; domain=blablabla.site.pl; path=/;
(I know that it looks like this because I've chacked it with a different
program)
Ok, so as you can see this cookie is a short-time cookie because it
doesn't
provide an expiration time. So that meens it's 'alive' only till I close a
session (normally it's when closing a browser or when writting a different
URL
in the browser after this one). When using a browser to open this URL
which
generated the cookie I get a page with a link to another site which is
using
this cookie. So when I normally click the link in the browser the cookie
is
being passed to another site by a new url (it's a php way of passing
cookies)
and it looks like this:
http://blablabla.site.pl/?we=airstrikerkod=773321
(as you can see the only data that the cookie passes is that number
generated by random)
And that's how it look's like in a browser (f.i. IE).
Now let's get back to your demo HttpTst and let's ask some questions
again;)
1. You said: You can use any storage method you like to save the cookie.
- I don't
need to save this cookie on a disc because I don't need it after the
session is closed so
any other method to do this would be great (can you please write a really
simple code how to
do this because I am quite new to it? :(
2. How should it be done to simulate clicking a link? The idea is simple -
it must be
the same session - so how to keep the session alive after opening the
first URL? And how
to open the next URL in the same session? Or maybe the session is alive
all the time till I
close the HttpTst program? What's the answer?
3. Forgive me please my nooblike questions but I am quite new to the
subject and sure would
like to learn more;)
Thx for help!
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
--
To unsubscribe