Thread [HTTP::Async] in Verbindung mit RewriteRule in der .htaccess (30 answers)
Opened by bianca at 2016-03-04 17:02

bianca
 2016-03-06 07:44
#184059 #184059
User since
2009-09-13
6975 Artikel
BenutzerIn

user image
Leider keine Änderung, bleibt bei 503, habe es vor und hinter $id_entfernt = $async->add($request) versucht.
Sieht dann aktuell so aus:
Code (perl): (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
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
require Data::Dumper; Data::Dumper->import(qw(Dumper));
use 5.010;

my $generiere_objekt = sub {
    my ($var) = @_;
    if (!defined $$var) {
        $$var = HTTP::Async->new(
            timeout             => 10,
            max_request_time    => 15,
            cookie_jar          => defined,
        );
    }
};
my $async;
my $id_entfernt = 0;

require HTTP::Async;
require HTTP::Request::Common;
use Net::HTTPS::NB;
my $request = HTTP::Request->new(
    'GET',
    'https://meine.domain:443/cgi-bin/meinscript.pl?key=val',
    HTTP::Headers->new(),
);
$generiere_objekt->(\$async);
my %ssl_options = (
    verify_hostname => 0,
    blocking        => 0,
);
$async->ssl_options(\%ssl_options);
$id_entfernt = $async->add($request);

if (defined $async) {
    while (my($response,$id) = $async->wait_for_next_response) {
        say "ID $id :",Dumper($response);
        say $response->is_error;
        say $response->code;
    }
}


STDOUT:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ID 1 :$VAR1 = bless( {
'_request' => bless( {
'_method' => 'GET',
'_headers' => bless( {}, 'HTTP::Headers' ),
'_content' => '',
'_uri' => bless( do{\(my $o = 'https://meine.domain:443/cgi-bin/meinscript.pl?key=val')}, 'URI::https' )
}, 'HTTP::Request' ),
'_msg' => 'Service Unavailable',
'_content' => '',
'_headers' => bless( {}, 'HTTP::Headers' ),
'_rc' => 503
}, 'HTTP::Response' );

1
503


Mit diesen Rewrites auf dem Server:
Code: (dl )
1
2
3
4
5
6
7
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{QUERY_STRING} (.+)=(.+)
RewriteCond %{REQUEST_URI} !/cgi-bin/meinscript.pl
RewriteRule .* https://meine.domain/cgi-bin/meinscript.pl?%1=%2 [L]

RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://meine.domain/$1 [L]

Was kann ich noch versuchen?
10 print "Hallo"
20 goto 10

View full thread [HTTP::Async] in Verbindung mit RewriteRule in der .htaccess