Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
the get command needs to use a new user agent or applications would b…
…e unable to use theirs
  • Loading branch information
kraih committed Feb 4, 2016
1 parent c6f119f commit 7285514
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@

6.44 2016-02-02
- Removed deprecated format_regex attribute from Mojolicious::Routes::Pattern.
- Improved get command not to use the user agent of the application.
- Improved Mojo::JSON performance slightly.

6.43 2016-02-01
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojolicious/Command/get.pm
Expand Up @@ -6,6 +6,7 @@ use Mojo::DOM;
use Mojo::IOLoop;
use Mojo::JSON qw(encode_json j);
use Mojo::JSON::Pointer;
use Mojo::UserAgent;
use Mojo::Util qw(decode encode);
use Scalar::Util 'weaken';

Expand All @@ -31,9 +32,8 @@ sub run {
my %headers = map { /^\s*([^:]+)\s*:\s*(.+)$/ ? ($1, $2) : () } @headers;

# Detect proxy for absolute URLs
my $ua = $self->app->ua->ioloop(Mojo::IOLoop->singleton);
$ua->server->ioloop(Mojo::IOLoop->singleton);
$ua->proxy->detect unless $url =~ m!^/!;
my $ua = Mojo::UserAgent->new(ioloop => Mojo::IOLoop->singleton);
$url !~ m!^/! ? $ua->proxy->detect : $ua->server->app($self->app);
$ua->max_redirects(10) if $redirect;

my $buffer = '';
Expand Down

0 comments on commit 7285514

Please sign in to comment.