Skip to content

Commit

Permalink
made proxy support more portable
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 28, 2009
1 parent c15e67f commit 5930852
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
5 changes: 4 additions & 1 deletion Changes
@@ -1,6 +1,9 @@
This file documents the revision history for Perl extension Mojo.

0.991242 2009-07-20 00:00:00
0.991243 2009-07-28 00:00:00
- Made proxy support more portable.

0.991242 2009-07-27 00:00:00
- Cleaned up the whole script system, this change is mostly backwards
compatible except for a few cases.
"daemon $port" now becomes "daemon -p $port"
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo.pm
Expand Up @@ -18,7 +18,7 @@ __PACKAGE__->attr('home', default => sub { Mojo::Home->new });
__PACKAGE__->attr('log', default => sub { Mojo::Log->new });

# Oh, so they have internet on computers now!
our $VERSION = '0.991242';
our $VERSION = '0.991243';

sub new {
my $self = shift->SUPER::new(@_);
Expand Down
5 changes: 0 additions & 5 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -120,11 +120,6 @@ sub proxy {
return $self;
}

# Environment
elsif (!$self->{proxy} && $ENV{HTTP_PROXY}) {
$self->{proxy} = Mojo::URL->new($ENV{HTTP_PROXY});
}

return $self->{proxy};
}

Expand Down
4 changes: 1 addition & 3 deletions t/mojo/message.t
Expand Up @@ -323,21 +323,19 @@ is($req->build,
. "Hello World!\n");

# Build full HTTP 1.1 proxy request
my $backup = $ENV{HTTP_PROXY} || '';
$ENV{HTTP_PROXY} = 'http://foo:bar@127.0.0.1:8080';
$req = Mojo::Message::Request->new;
$req->method('GET');
$req->url->parse('http://127.0.0.1/foo/bar');
$req->headers->expect('100-continue');
$req->body("Hello World!\n");
$req->proxy('http://foo:bar@127.0.0.1:8080');
is($req->build,
"GET http://127.0.0.1/foo/bar HTTP/1.1\x0d\x0a"
. "Expect: 100-continue\x0d\x0a"
. "Host: 127.0.0.1\x0d\x0a"
. "Proxy-Authorization: Basic Zm9vOmJhcg==\x0d\x0a"
. "Content-Length: 13\x0d\x0a\x0d\x0a"
. "Hello World!\n");
$ENV{HTTP_PROXY} = $backup;

# Build HTTP 1.1 multipart request
$req = Mojo::Message::Request->new;
Expand Down

0 comments on commit 5930852

Please sign in to comment.