Skip to content

Commit

Permalink
Follow redirects in plugin URL's
Browse files Browse the repository at this point in the history
  • Loading branch information
ehershey committed Nov 28, 2013
1 parent 2d46d08 commit ffb336e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions get_flash_videos
Expand Up @@ -672,6 +672,18 @@ sub install_plugin {

return 1;
}
# Handle redirects from plugin URL's, e.g. http to https
#
elsif ($browser->response->is_redirect) {
my $redirect_url = $browser->response->header('Location');

# Reconstruct new URI to account for relative redirect URL's
#
$redirect_url = URI->new_abs($redirect_url, $browser->response->base);
info "Plugin download redirected $redirect_url";

return install_plugin($browser, $redirect_url, $file);
}
else {
warn "Download failed: " . $browser->response->status_line;
}
Expand Down

0 comments on commit ffb336e

Please sign in to comment.