|
Lines 76-88
my $cookie_jar = HTTP::Cookies->new();
Link Here
|
| 76 |
my $cookie; |
76 |
my $cookie; |
| 77 |
$ua->cookie_jar($cookie_jar); |
77 |
$ua->cookie_jar($cookie_jar); |
| 78 |
my $resp = $ua->post( "$baseurl"."/svc/authentication" , {userid =>$user, password => $password} ); |
78 |
my $resp = $ua->post( "$baseurl"."/svc/authentication" , {userid =>$user, password => $password} ); |
| 79 |
if( $resp->is_success ) { |
79 |
if( $resp->is_success and $resp->content =~ m|<status>ok</status>| ) { |
| 80 |
$cookie_jar->extract_cookies( $resp ); |
80 |
$cookie_jar->extract_cookies( $resp ); |
| 81 |
$cookie = $cookie_jar->as_string; |
81 |
$cookie = $cookie_jar->as_string; |
| 82 |
unless ($short_print) { |
82 |
unless ($short_print) { |
| 83 |
print "Authentication successful\n"; |
83 |
print "Authentication successful\n"; |
| 84 |
print "Auth:\n $resp->content" if $debug; |
84 |
print "Auth:\n $resp->content" if $debug; |
| 85 |
} |
85 |
} |
|
|
86 |
} elsif ( $resp->is_success ) { |
| 87 |
die "Authentication failure: bad login/password"; |
| 88 |
} else { |
| 89 |
die "Authentication failure: \n\t" . $resp->status_line; |
| 86 |
} |
90 |
} |
| 87 |
|
91 |
|
| 88 |
# remove some unnecessary garbage from the cookie |
92 |
# remove some unnecessary garbage from the cookie |
| 89 |
- |
|
|