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;.
In reply to Re: lwp+w/o jsessionid
by ikegami
in thread lwp+w/o jsessionid
by opensourcer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |