Skip to content

Commit

Permalink
changed number of redirects ojo and the get command will follow to 10
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 25, 2012
1 parent 4d23e17 commit 052e1b2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
This file documents the revision history for Perl extension Mojolicious.

2.69 2012-03-25
- Changed number of redirects ojo and the get command will follow to 10.
- Improved Mojo::DOM::CSS performance.
- Improved documentation.
- Improved Mojo::Reactor tests to be less strict.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Command/get.pm
Expand Up @@ -32,7 +32,7 @@ These options are available:
-c, --content <content> Content to send with request.
-H, --header <name:value> Additional HTTP header.
-M, --method <method> HTTP method to use, defaults to "GET".
-r, --redirect Follow up to 5 redirects.
-r, --redirect Follow up to 10 redirects.
-v, --verbose Print request and response headers to STDERR.
EOF

Expand Down Expand Up @@ -71,7 +71,7 @@ sub run {

# Fresh user agent
my $ua = Mojo::UserAgent->new(ioloop => Mojo::IOLoop->singleton);
$ua->max_redirects(5) if $redirect;
$ua->max_redirects(10) if $redirect;

# Absolute URL
if ($url !~ m#/#) { $ua->detect_proxy }
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Command/version.pm
Expand Up @@ -47,7 +47,7 @@ EOF
my ($current) = $Mojolicious::VERSION =~ /^([^_]+)/;
my $latest = $current;
eval {
Mojo::UserAgent->new->max_redirects(3)
Mojo::UserAgent->new->max_redirects(10)
->get('search.cpan.org/dist/Mojolicious')->res->dom('.version')
->each(sub { $latest = $_->text if $_->text =~ /^[\d\.]+$/ });
};
Expand Down
4 changes: 2 additions & 2 deletions lib/ojo.pm
Expand Up @@ -30,7 +30,7 @@ sub import {
eval "package $caller; use Mojolicious::Lite;";

# Allow redirects
$UA->max_redirects(1) unless defined $ENV{MOJO_MAX_REDIRECTS};
$UA->max_redirects(10) unless defined $ENV{MOJO_MAX_REDIRECTS};

# Application
$UA->app(*{"${caller}::app"}->());
Expand Down Expand Up @@ -137,7 +137,7 @@ resulting L<Mojo::Message::Response> object.
my $res = g('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform C<GET> request with L<Mojo::UserAgent/"get"> and return resulting
L<Mojo::Message::Response> object. One redirect will be followed by default,
L<Mojo::Message::Response> object. Ten redirects will be followed by default,
you can change this behavior with the C<MOJO_MAX_REDIRECTS> environment
variable.
Expand Down

0 comments on commit 052e1b2

Please sign in to comment.