302 test
This commit is contained in:
parent
a4ea373e0d
commit
e6bc578e11
3 changed files with 14 additions and 11 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.idea/
|
|
@ -1,3 +0,0 @@
|
||||||
# tools
|
|
||||||
|
|
||||||
Tools for Project
|
|
|
@ -1,17 +1,22 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
use Parse::RPM::Spec;
|
use Parse::RPM::Spec;
|
||||||
use LWP::UserAgent ();
|
use HTTP::Tiny;
|
||||||
|
|
||||||
my $spec = Parse::RPM::Spec->new( { file => @ARGV } );
|
my $spec = Parse::RPM::Spec->new( { file => @ARGV } );
|
||||||
say $spec->name;
|
print $spec->name . "\n";
|
||||||
my $url = $spec->url;
|
my $url = $spec->url();
|
||||||
my $response = LWP::UserAgent->new( timeout => 10 )->get($url);
|
say $url;
|
||||||
if ($response->is_success) {
|
my $response = HTTP::Tiny->new( timeout => 10 )->get($url);
|
||||||
print $response->decoded_content;
|
if ( $response->{status} == 200 ) {
|
||||||
|
if ( $response->{url} ne $url ) {
|
||||||
|
say "302 Redirect. Redirect to";
|
||||||
|
say $response->{url};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
die $response->status_line;
|
say "Cannot get! Status " . $response->{status};
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue