Thread LWP und proxy (52 answers)
Opened by perl-snaks at 2012-04-25 13:04

GwenDragon
 2012-04-27 15:44
#157908 #157908
User since
2005-01-17
14533 Artikel
Admin1
[Homepage]
user image
Wieso kenne ich das Problem irgendwie: https authentication error
Vielleicht Redirects ausschalten (Zeile 12 meines Codes dort)?

Wenn du das mal so testest:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use strict;
use warnings;

use LWP::UserAgent;

my $pw='abcdefg';
my $us='1234567';
my $url = "https://poms-test.ts.fujitsu.com/CallLog";

my $ua = LWP::UserAgent->new;
$ua->requests_redirectable(undef); # Redirects ausschalten!

$ua->credentials("poms-test.ts.fujitsu.com:443", "POMS2", $us, $pw);

$ua->proxy( https  => 'http://www-proxy.t-online.de');

$ua->add_handler("request_send",  sub { shift->dump; return });
$ua->add_handler("response_done", sub { shift->dump; return });

my $response = $ua->post($url,[0=>0]);

Siehst du, dass es sehr wohl über einen Proxy (nämlich den von T-Online) geht.
Aber es ist auch beim Dump der header sichtbar, dass der Realm nicht POMS2 ist! Schau dir die Zeile mal an, in der Ausgabe. ;)

more (3.6kb):
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
POST https://poms-test.ts.fujitsu.com/CallLog
User-Agent: libwww-perl/6.04
Content-Length: 3
Content-Type: application/x-www-form-urlencoded

0=0
HTTP/1.0 401 Unauthorized
Connection: close
Date: Fri, 27 Apr 2012 15:58:56 +0200
Via: 1.0 f-cw-b03.isp.t-ipnet.de (squid)
Server: Poms HTTP Interface 1.1
WWW-Authenticate: Basic realm=POMS2 HTTP Interface Login
Content-Length: 1554
Content-Type: text/html
Last-Modified: Fri, 27 Apr 2012 15:58:56 +0200
Client-Date: Fri, 27 Apr 2012 13:58:47 GMT
Client-Peer: 217.237.150.51:80
Client-Response-Num: 1
Set-Cookie: ISAWPLB{1D1E5963-5085-4C94-BEED-1230BA03921A}={8A76F960-EAAE-4A7A-9CAC-3EE9C6F38666}; HttpOnly; Path=/
Title: Siemens PERLE-POMS2 HTTP Answer
X-Cache: MISS from f-lb-b01.isp.t-ipnet.de
X-Cache-Lookup: MISS from f-lb-b01.isp.t-ipnet.de:80

<html>\n
<head>\n
<title>Siemens PERLE-POMS2 HTTP Answer</title>\n
<style type="text/css">
<!--
body { background-color:black; margin:0;}\n
.Ueberschrift1 { text-align:left; color:aqua; font-size:13pt; font-weight:bold; font-family:Arial;}
.Ueberschrift2 { text-align:left; color:aqua; font-size:13pt; font-weight:bold; font-family:Arial;}
.Text1 { text-align:center; color:red; font-size:14pt; font-weight:bold; font-family:Arial;}
.Text2 { text-align:left; color:lime; font-si...
(+ 1042 more bytes not shown)
POST https://poms-test.ts.fujitsu.com/CallLog
Authorization: Basic MTIzNDU2NzphYmNkZWZn
User-Agent: libwww-perl/6.04
Content-Length: 3
Content-Type: application/x-www-form-urlencoded

0=0
HTTP/1.0 401 Unauthorized
Connection: close
Date: Fri, 27 Apr 2012 15:58:57 +0200
Via: 1.0 f-cw-b01.isp.t-ipnet.de (squid)
Server: Poms HTTP Interface 1.1
WWW-Authenticate: Basic realm=POMS2 HTTP Interface Login
Content-Length: 1554
Content-Type: text/html
Last-Modified: Fri, 27 Apr 2012 15:58:57 +0200
Client-Date: Fri, 27 Apr 2012 13:58:48 GMT
Client-Peer: 217.237.150.51:80
Client-Response-Num: 1
Set-Cookie: ISAWPLB{1D1E5963-5085-4C94-BEED-1230BA03921A}={8A76F960-EAAE-4A7A-9CAC-3EE9C6F38666}; HttpOnly; Path=/
Title: Siemens PERLE-POMS2 HTTP Answer
X-Cache: MISS from f-lb-b01.isp.t-ipnet.de
X-Cache-Lookup: MISS from f-lb-b01.isp.t-ipnet.de:80

<html>\n
<head>\n
<title>Siemens PERLE-POMS2 HTTP Answer</title>\n
<style type="text/css">
<!--
body { background-color:black; margin:0;}\n
.Ueberschrift1 { text-align:left; color:aqua; font-size:13pt; font-weight:bold; font-family:Arial;}
.Ueberschrift2 { text-align:left; color:aqua; font-size:13pt; font-weight:bold; font-family:Arial;}
.Text1 { text-align:center; color:red; font-size:14pt; font-weight:bold; font-family:Arial;}
.Text2 { text-align:left; color:lime; font-si...
(+ 1042 more bytes not shown)

Last edited: 2012-04-27 15:59:47 +0200 (CEST)
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

View full thread LWP und proxy