How can I automate and share sessions between Firefox and Perl?
Is it possible to do part of a web flow in Perl and then transfer the rest of the session to Firefox?
I need to retry(with Perl) logging in to a websi开发者_运维问答te which returns 500 every now and then on a successful login, transfer the authenticated session to Firefox, from where I can continue my normal browsing. Is this possible? If this is possible, how do I do it? Can you point me to some resources on how can transfer the cookie/session, etc ?To me, it seems that it makes more sense to do everything from within Firefox ... and control that from the outside. MozRepl (the FF extension) and MozRepl (the Perl module) may help you in getting there.
Tricky. You will not be able to have your server log in to the 3rd party service, and then just serve up the session cookie to your user, and redirect him to the 3rd party app. This will not work because cookies are domain specific, and domains cannot access cookies from or set by another domain.
So your service will need to act as an interface to the third party service, and as such you will need to maintain a user session on your server. This user session keeps track of your user, will log in to third party service, and will make requests to the 3rd party service when appropriate. The session on your server will be an http client for this 3rd party service, so it will need to be able to handle cookies correctly - ie mimic a browser.
In terms of setting up and maintaining user sessions, there will be a number of CPAN modules to help you with this.
For more info on managing user sessions in Perl, see https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-1044683.html
Edit: some web services can manage user sessions by injecting a session id into the URL when the client refuses cookies. If your 3rd party service will do this, you could maybe just serve up the login response URL as a redirect to your user. However, this will break if sessions are bound to an IP.
精彩评论