in reply to lwp+w/o jsessionid
One way:
Create a subclass of LWP::UserAgent that overrides request to remove the jsessionid from the requested url.
use strict; use warnings; package My::UserAgent; BEGIN { our @ISA = 'LWP::UserAgent'; } use LWP::UserAgent qw( ); use URI qw( ); use URI::QueryParam qw( ); sub request { my $self = shift; my $request = shift; my $uri = URI->new( $request->uri() ); $uri->query_param_delete( 'jsessionid' ); $request->uri( $uri ); return $self->SUPER::request( $request, @_ ); } 1;
Beware that this might cause infinite loops if the server insists on you using jsessionid. Well, not quite infinite since LWP::UserAgent stops redirecting after max_redirect redirects (default is 7).
Update: Fixed bug mentioned in reply. Added use strict; and use warnings;.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: lwp+w/o jsessionid
by opensourcer (Monk) on Sep 21, 2008 at 04:06 UTC | |
by ikegami (Patriarch) on Sep 21, 2008 at 04:25 UTC |