Thread https authentication error (78 answers)
Opened by a_abels at 2011-10-10 15:16

a_abels
 2011-10-12 15:37
#153136 #153136
User since
2010-07-11
90 Artikel
BenutzerIn
[default_avatar]
Hllo,

gesagt, getan. Ich mache jetzt erstmal alles in meinem Büro, also ohne Proxy.

Mein Script:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use strict;
use LWP::UserAgent;
use Crypt::SSLeay;
use LWP::Debug qw(+);
use HTTP::Cookies;

my $cookie_jar = HTTP::Cookies->new(
file => "$ENV{'HOME'}/lwp_cookies.dat",
autosave => 1,
);

### Message Parameter
my $parameter = @ARGV[0];
my @parameters = split( /;:;/, $parameter);
my $msg_node = $parameters[0];

my $ua = LWP::UserAgent->new;

my $ie_ua = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)';
$ua->agent($ie_ua);
$ua->cookie_jar($cookie_jar);

#$ua->credentials("poms-test.ts.fujitsu.com:80", "POMS2 HTTP Interface Login", "username", "password");
$ua->credentials('poms-test.ts.fujitsu.com:80', 'POMS2 HTTP Interface Login', 'username', 'password');

my $response = $ua->post('https://poms-test.ts.fujitsu.com/CallLog',
[
msg_node => $msg_node
]);

if ($response->is_success) {
print "\n\nis success (content):", $response->content, "\n\n";
}
else {
print "\n\nis not success (status_line): ", $response->status_line, "\n\n";
# print "\n\nis not success (content):", $response->content, "\n\n";
}


Output:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking poms-test.ts.fujitsu.com for cookies
HTTP::Cookies::add_cookie_header: Checking .ts.fujitsu.com for cookies
HTTP::Cookies::add_cookie_header: Checking ts.fujitsu.com for cookies
HTTP::Cookies::add_cookie_header: Checking .fujitsu.com for cookies
HTTP::Cookies::add_cookie_header: Checking fujitsu.com for cookies
HTTP::Cookies::add_cookie_header: Checking .com for cookies
LWP::UserAgent::send_request: POST https://poms-test.ts.fujitsu.com/CallLog
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 622 bytes
LWP::Protocol::collect: read 932 bytes
HTTP::Cookies::extract_cookies: Set cookie ISAWPLB{1D1E5963-5085-4C94-BEED-1230BA03921A} => {8A76F960-EAAE-4A7A-9CAC-3EE9C6F38666}
LWP::UserAgent::request: Simple response: Unauthorized


is not success (status_line): 401 Unauthorized


Der Inhalt von lwp_cookies.dat:
Code: (dl )
#LWP-Cookies-1.0


Steht nicht viel drin, in der lwp_cookies.dat, oder?

mfg André

Last edited: 2011-10-12 16:38:15 +0200 (CEST)
Antworten mit Zitat

View full thread https authentication error