1
2
3
4
5
6
7
8
500 Can't connect to www.rationalgalerie.de:443
Content-Type: text/plain
Client-Date: Fri, 14 Feb 2025 11:49:19 GMT
Client-Warning: Internal response
Can't connect to www.rationalgalerie.de:443
Bad file descriptor at C:/Perl64/lib/LWP/Protocol/http.pm line 47.
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
package XHR; # Analog zu JavaScript XHR use strict; use warnings; use HTTP::Request; use LWP::UserAgent; sub new{ my $class = shift; my $callback = shift; bless { ua => LWP::UserAgent->new(), cb => $callback }, $class; } sub request{ my $self = shift; my %par = ( method => 'GET', uri => '', content => '', header => [], @_ ); my $r = HTTP::Request->new( @par{qw(method uri header content)} ); my $res = $self->{ua}->request($r); $self->{cb}->($res); } ########################################################################### package main; use strict; use warnings; sub callback{ my $self = shift; # Response Objekt print $self->as_string; } my $xhr = new XHR(*callback); $xhr->request( uri => 'https://www.rationalgalerie.de/', );
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
T:\>perl -w code_196861_2.txt | more
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: Upgrade, close
Date: Fri, 14 Feb 2025 15:29:14 GMT
Pragma: no-cache
Upgrade: h2,h2c
Server: Apache
Vary: Accept-Encoding,User-Agent
Content-Type: text/html; charset=utf-8
Expires: Wed, 17 Aug 2005 00:00:00 GMT
Last-Modified: Fri, 14 Feb 2025 15:29:15 GMT
Client-Date: Fri, 14 Feb 2025 15:29:15 GMT
Client-Peer: 85.13.136.12:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=Let's Encrypt/CN=R11
Client-SSL-Cert-Subject: /CN=rationalgalerie.de
Client-SSL-Cipher: TLS_AES_256_GCM_SHA384
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Version: TLSv1_3
Client-Transfer-Encoding: chunked
Link: </?format=feed&type=rss>; rel="alternate"; title="Home"; type="application/rss+xml"
Link: </?format=feed&type=atom>; rel="alternate"; title="Home"; type="application/atom+xml"
Link: <https://www.rationalgalerie.de/suche-finder?format=opensearch>; rel="search"; title="OpenSearch Rationalgalerie"; type="application/opensearchdescription+xml"
Link: </templates/rationalgalerie/favicon.ico>; rel="icon"; type="image/vnd.microsoft.icon"
Link: </media/vendor/awesomplete/css/awesomplete.css?1.1.7>; rel="stylesheet"
Link: </media/vendor/joomla-custom-elements/css/joomla-alert.min.css?0.2.0>; rel="stylesheet"
Link: </media/plg_system_jcepro/site/css/content.min.css?86aa0286b6232c4a5b58f892ce080277>; rel="stylesheet"
Link: </media/com_rsform/css/front.min.css?7fa4fd>; rel="stylesheet"
Link: <https://www.rationalgalerie.de/media/plg_karo3slidecaptcha/css/style.css>; rel="stylesheet"
Link: </templates/rationalgalerie/css/template.css?v1.0.2>; rel="stylesheet"; type="text/css"
Set-Cookie: 7e061b46d55cc690f64b34ecddb5139f=27ba2e05187dfc664876f6dc894d4d79; path=/; HttpOnly
Strict-Transport-Security: max-age=600000
Title: Home
…
^C
T:\>perl -V
Summary of my perl5 (revision 5 version 36 subversion 3) configuration:
QuoteMozilla::CA - Mozilla's CA cert bundle in PEM format
1 2 3 4 5 6 7 8 9
my $s = IO::Socket::SSL->new("www.rationalgalerie.de:443") or die $@; $s->print("GET / HTTP/1.0\r\n"); $s->print("Host: www.rationalgalerie.de\r\n"); $s->print("\r\n\r\n"); while( read($s, my $buffer, 1024) ){ print $buffer; }
2025-02-14T15:35:24 GwenDragonHast du Mozilla::CA installiert?
Ich benutze als aktuelle Zertifikate von CURLs website die Datei
und habe übrigens zum Testen von Perl mit Zertifikaten das unter Windows als Umgebungsvariable für Benutzer gesetzt:
SSL_CERT_FILE mit Wert X:\etc\ssl\certs\cacert.pem
QuoteThe libwww-perl core no longer bundles protocol plugins for SSL. You will need to install LWP::Protocol::https separately to enable support for processing https-URLs.
2025-02-18T13:51:16 rostiUnd ja, sowohl LWP::Protocol::https als auch Mozilla::CA ist installiert. Auch Crypt::SSLeay (als Pendant zu openSSL auf Win32)
1 2 3 4 5 6 7 8 9 10 11 12
use strict; use warnings; use base qw(Factory); my $res = main->request( uri => 'https://www.example.com' ); printf( qq( Response => %s Mozilla::CA::VERSION => %s LWP::Protocol::https::VERSION => %s IO::Socket::SSL::VERSION => %s ), $res->status_line, $Mozilla::CA::VERSION, $LWP::Protocol::https::VERSION, $IO::Socket::SSL::VERSION);
1
2
3
4
5
6
7
8
Response => 200 OK
Mozilla::CA::VERSION => 20150826
LWP::Protocol::https::VERSION => 6.06
IO::Socket::SSL::VERSION => 2.020
This is perl 5, version 22, subversion 1 (v5.22.1) built for MSWin32-x64-multi-thread
ActiveState
1
2
3
4
5
6
7
8
500 Can't connect to www.rationalgalerie.de:443
Content-Type: text/plain
Client-Date: Tue, 18 Feb 2025 15:21:28 GMT
Client-Warning: Internal response
Can't connect to www.rationalgalerie.de:443
Bad file descriptor at C:/Perl64/lib/LWP/Protocol/http.pm line 47.
QuoteThe libwww-perl core no longer bundles protocol plugins for SSL. You
will need to install LWP::Protocol::https separately to enable
support for processing https-URLs.
QuoteMozilla::CA::VERSION => 20150826
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Perl 5.22 T:\>perl ver.pl
Mozilla::CA::VERSION => 20160104
LWP::Protocol::https::VERSION => 6.06
IO::Socket::SSL::VERSION => 2.043
Perl 5.22 T:\>GET -USsed https://www.rationalgalerie.de
GET https://www.rationalgalerie.de
User-Agent: lwp-request/6.15 libwww-perl/6.15
500 Can't connect to www.rationalgalerie.de:443
Content-Type: text/plain
Client-Date: Wed, 19 Feb 2025 12:18:05 GMT
Client-Warning: Internal response
Perl 5.22 T:\>cpan Mozilla::CA
CPAN: CPAN::SQLite loaded ok (v0.211)
CPAN: LWP::UserAgent loaded ok (v6.15)
CPAN: Time::HiRes loaded ok (v1.9741)
Fetching with LWP:
http://cpan.strawberryperl.com/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to cpan.strawberryperl.com:443]
Warning: no success downloading 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp6188'. Giving up on it.
Fetching with LWP:
http://www.cpan.org/authors/01mailrc.txt.gz
CPAN: YAML::XS loaded ok (v0.63)
Fetching with LWP:
http://cpan.strawberryperl.com/modules/02packages.details.txt.gz
LWP failed with code[500] message[Can't connect to cpan.strawberryperl.com:443]
Warning: no success downloading 'C:\strawberry\cpan\sources\modules\02packages.details.txt.gz.tmp6188'. Giving up on it.
Fetching with LWP:
http://www.cpan.org/modules/02packages.details.txt.gz
Fetching with LWP:
http://cpan.strawberryperl.com/modules/03modlist.data.gz
LWP failed with code[500] message[Can't connect to cpan.strawberryperl.com:443]
Warning: no success downloading 'C:\strawberry\cpan\sources\modules\03modlist.data.gz.tmp6188'. Giving up on it.
Fetching with LWP:
http://www.cpan.org/modules/03modlist.data.gz
Creating database file ...
Done!
Running install for module 'Mozilla::CA'
Fetching with LWP:
http://www.cpan.org/authors/id/L/LW/LWP/Mozilla-CA-20250202.tar.gz
CPAN: Digest::SHA loaded ok (v5.96)
Fetching with LWP:
http://www.cpan.org/authors/id/L/LW/LWP/CHECKSUMS
CPAN: Compress::Zlib loaded ok (v2.07)
Checksum for C:\strawberry\cpan\sources\authors\id\L\LW\LWP\Mozilla-CA-20250202.tar.gz ok
CPAN: Archive::Tar loaded ok (v2.24)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20170114_22)
Configuring L/LW/LWP/Mozilla-CA-20250202.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a dmake-style Makefile
Writing Makefile for Mozilla::CA
Writing MYMETA.yml and MYMETA.json
LWP/Mozilla-CA-20250202.tar.gz
C:\strawberry\perl\bin\perl.exe Makefile.PL -- OK
Running make for L/LW/LWP/Mozilla-CA-20250202.tar.gz
cp lib/Mozilla/CA.pm blib\lib\Mozilla\CA.pm
cp lib/Mozilla/CA/cacert.pem blib\lib\Mozilla\CA\cacert.pem
LWP/Mozilla-CA-20250202.tar.gz
C:\strawberry\c\bin\dmake.exe -- OK
Running make test
"C:\strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/locate-file.t .. ok
All tests successful.
Files=1, Tests=2, 0 wallclock secs ( 0.00 usr + 0.02 sys = 0.02 CPU)
Result: PASS
LWP/Mozilla-CA-20250202.tar.gz
C:\strawberry\c\bin\dmake.exe test -- OK
Running make install
Installing C:\strawberry\perl\site\lib\Mozilla\CA.pm
Installing C:\strawberry\perl\site\lib\Mozilla\CA\cacert.pem
Appending installation info to C:\strawberry\perl\lib/perllocal.pod
LWP/Mozilla-CA-20250202.tar.gz
C:\strawberry\c\bin\dmake.exe install UNINST=1 -- OK
Perl 5.22 T:\>perl ver.pl
Mozilla::CA::VERSION => 20250202
LWP::Protocol::https::VERSION => 6.06
IO::Socket::SSL::VERSION => 2.043
Perl 5.22 T:\>GET -USsed https://www.rationalgalerie.de
GET https://www.rationalgalerie.de
User-Agent: lwp-request/6.15 libwww-perl/6.15
200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: Upgrade, close
Date: Wed, 19 Feb 2025 12:19:18 GMT
Pragma: no-cache
Upgrade: h2,h2c
Server: Apache
Vary: Accept-Encoding,User-Agent
Content-Type: text/html; charset=utf-8
Expires: Wed, 17 Aug 2005 00:00:00 GMT
Last-Modified: Wed, 19 Feb 2025 12:19:18 GMT
Client-Date: Wed, 19 Feb 2025 12:19:16 GMT
Client-Peer: 85.13.136.12:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=Let's Encrypt/CN=R10
Client-SSL-Cert-Subject: /CN=rationalgalerie.de
Client-SSL-Cipher: ECDHE-RSA-AES128-GCM-SHA256
Client-SSL-Socket-Class: IO::Socket::SSL
Client-Transfer-Encoding: chunked
Link: </?format=feed&type=rss>; rel="alternate"; title="Home"; type="application/rss+xml"
Link: </?format=feed&type=atom>; rel="alternate"; title="Home"; type="application/atom+xml"
Link: <https://www.rationalgalerie.de/suche-finder?format=opensearch>; rel="search"; title="OpenSearch Rationalgalerie"; type="application/opensearchdescription+xml"
Link: </templates/rationalgalerie/favicon.ico>; rel="icon"; type="image/vnd.microsoft.icon"
Link: </media/vendor/awesomplete/css/awesomplete.css?1.1.7>; rel="stylesheet"
Link: </media/vendor/joomla-custom-elements/css/joomla-alert.min.css?0.2.0>; rel="stylesheet"
Link: </media/plg_system_jcepro/site/css/content.min.css?86aa0286b6232c4a5b58f892ce080277>; rel="stylesheet"
Link: </media/com_rsform/css/front.min.css?7fa4fd>; rel="stylesheet"
Link: <https://www.rationalgalerie.de/media/plg_karo3slidecaptcha/css/style.css>; rel="stylesheet"
Link: </templates/rationalgalerie/css/template.css?v1.0.2>; rel="stylesheet"; type="text/css"
Set-Cookie: 7e061b46d55cc690f64b34ecddb5139f=4bbac3cc170eed063f48399cb0a2e608; path=/; HttpOnly
Strict-Transport-Security: max-age=600000
Title: Home
X-Content-Type-Options: nosniff
X-Meta-Charset: utf-8
X-Meta-Generator: Joomla! - Open Source Content Management
X-Meta-Viewport: width=device-width, initial-scale=1
2025-02-20T15:04:49 RaubtierIch habe schon lange kein Perl mehr gemacht und bin nicht auf dem neuesten Stand.
Gibt es sowas wie eine pyproject.toml & uv.lock in Python, d.h. eine Datei, wo man Dependencies für ein Projekt definiert und ein Tool, das das alles downloadet und installiert - und vor allem inkl. der Abhängigkeiten der Abhängigkeiten (+weiter rekursiv) auflöst und abspeichert, sodass man genau reproduzieren kann, was man installiert hat?
2025-02-20T15:04:49 RaubtierUnd gibt es sowas wie "venv" in Python, also Projektumgebungen, sodass Projekt A Version 1 und Projekt B Version 2 von ein und derselben Bibliothek nutzen kann?
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
Perl 5.22 T:\>GET -USsed https://www.rationalgalerie.de
GET https://www.rationalgalerie.de
User-Agent: lwp-request/6.15 libwww-perl/6.15
200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: Upgrade, close
Date: Thu, 20 Feb 2025 16:12:44 GMT
Pragma: no-cache
Upgrade: h2,h2c
Server: Apache
Vary: Accept-Encoding,User-Agent
Content-Type: text/html; charset=utf-8
Expires: Wed, 17 Aug 2005 00:00:00 GMT
Last-Modified: Thu, 20 Feb 2025 16:12:45 GMT
Client-Date: Thu, 20 Feb 2025 16:12:45 GMT
Client-Peer: 85.13.136.12:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=Let's Encrypt/CN=R10
Client-SSL-Cert-Subject: /CN=rationalgalerie.de
Client-SSL-Cipher: ECDHE-RSA-AES128-GCM-SHA256
Client-SSL-Socket-Class: IO::Socket::SSL
Client-Transfer-Encoding: chunked
Link: </?format=feed&type=rss>; rel="alternate"; title="Home"; type="application/rss+xml"
Link: </?format=feed&type=atom>; rel="alternate"; title="Home"; type="application/atom+xml"
Link: <https://www.rationalgalerie.de/suche-finder?format=opensearch>; rel="search"; title="OpenSearch Rationalgalerie"; type="application/opensearchdescription+xml"
Link: </templates/rationalgalerie/favicon.ico>; rel="icon"; type="image/vnd.microsoft.icon"
Link: </media/vendor/awesomplete/css/awesomplete.css?1.1.7>; rel="stylesheet"
Link: </media/vendor/joomla-custom-elements/css/joomla-alert.min.css?0.2.0>; rel="stylesheet"
Link: </media/plg_system_jcepro/site/css/content.min.css?86aa0286b6232c4a5b58f892ce080277>; rel="stylesheet"
Link: </media/com_rsform/css/front.min.css?7fa4fd>; rel="stylesheet"
Link: <https://www.rationalgalerie.de/media/plg_karo3slidecaptcha/css/style.css>; rel="stylesheet"
Link: </templates/rationalgalerie/css/template.css?v1.0.2>; rel="stylesheet"; type="text/css"
Set-Cookie: 7e061b46d55cc690f64b34ecddb5139f=d9ea34d113978a0cb9e3ecf25d892bed; path=/; HttpOnly
Strict-Transport-Security: max-age=600000
Title: Home
X-Content-Type-Options: nosniff
X-Meta-Charset: utf-8
X-Meta-Generator: Joomla! - Open Source Content Management
X-Meta-Viewport: width=device-width, initial-scale=1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
use strict; use warnings; use LWP::UserAgent; sub request{ my $self = shift; my %par = ( method => 'GET', uri => '', header => [], content => '', @_ ); if( ref $par{header} eq 'HASH' ){ $par{header} = HTTP::Headers->new( %{$par{header}} ); } my $ua = LWP::UserAgent->new(); my $req = HTTP::Request->new( @par{qw(method uri header content)} ); my $res = $ua->request($req); }
QuoteSollte man es nicht vermeiden, den UserAgenten für jeden Request neu zu instantiieren? Kann es da bei starker Last nicht zu Problemen mit verfügbaren Sockets kommen?