Skip to content

Commit

Permalink
improved ojo to detect proxy servers automatically (closes #304)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 26, 2012
1 parent f2bf2bd commit b57372c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@ This file documents the revision history for Perl extension Mojolicious.

2.69 2012-03-26
- Changed number of redirects ojo and the get command will follow to 10.
- Improved ojo to detect proxy servers automatically.
- Improved Mojo::DOM::CSS performance.
- Improved documentation.
- Improved Mojo::Reactor tests to be less strict.
Expand Down
7 changes: 5 additions & 2 deletions lib/ojo.pm
Expand Up @@ -32,6 +32,9 @@ sub import {
# Allow redirects
$UA->max_redirects(10) unless defined $ENV{MOJO_MAX_REDIRECTS};

# Detect proxy
$UA->detect_proxy unless defined $ENV{MOJO_PROXY};

# Application
$UA->app(*{"${caller}::app"}->());

Expand Down Expand Up @@ -91,10 +94,10 @@ C<MOJO_MAX_REDIRECTS> environment variable.
$ MOJO_MAX_REDIRECTS=0 perl -Mojo -E 'say g("mojolicio.us")->code'
Proxy detection is disabled by default, but you can enable it with the
Proxy detection is enabled by default, but you can disable it with the
C<MOJO_PROXY> environment variable.
$ MOJO_PROXY=1 perl -Mojo -E 'say g("mojolicio.us")->body'
$ MOJO_PROXY=0 perl -Mojo -E 'say g("mojolicio.us")->body'
=head1 FUNCTIONS
Expand Down
6 changes: 1 addition & 5 deletions t/mojo/dom.t
Expand Up @@ -2,17 +2,13 @@ use Mojo::Base -strict;

use utf8;

use Test::More tests => 726;
use Test::More tests => 725;

# "Homer gave me a kidney: it wasn't his, I didn't need it,
# and it came postage due- but I appreciated the gesture!"
use ojo;
use Mojo::DOM;
use Mojo::Util 'encode';

# ojo
is x('<div>Hello ♥!</div>')->at('div')->text, 'Hello ♥!', 'right text';

# Simple (basics)
my $dom = Mojo::DOM->new->parse(
'<div><div FOO="0" id="a">A</div><div id="b">B</div></div>');
Expand Down
1 change: 1 addition & 0 deletions t/mojo/user_agent_online.t
Expand Up @@ -3,6 +3,7 @@ use Mojo::Base -strict;
# Disable libev and TLS
BEGIN {
$ENV{MOJO_NO_TLS} = 1;
$ENV{MOJO_PROXY} = 0;
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}

Expand Down
1 change: 1 addition & 0 deletions t/mojolicious/ojo.t
Expand Up @@ -6,6 +6,7 @@ use utf8;
BEGIN {
$ENV{MOJO_MODE} = 'development';
$ENV{MOJO_NO_BONJOUR} = $ENV{MOJO_NO_IPV6} = 1;
$ENV{MOJO_PROXY} = 0;
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}

Expand Down

0 comments on commit b57372c

Please sign in to comment.