Name

SPVM::Mojo::UserAgent::Proxy - User agent proxy manager

Description

Mojo::UserAgent::Proxy class in SPVM manages proxy servers for Mojo::UserAgent.

Usage

use Mojo::UserAgent::Proxy;

my $proxy = Mojo::UserAgent::Proxy->new;
$proxy->detect;
say $proxy->http;

Fields

http

has http : rw string;

Proxy server to use for HTTP and WebSocket requests.

https

has https : rw string;

Proxy server to use for HTTPS and WebSocket requests.

not

has not : rw string[];

Domains that don't require a proxy server to be used.

Class Methods

static method new : Mojo::UserAgent::Proxy ();

Create a new Mojo::UserAgent::Proxy object, and return it.

Instance Methods

detect

method detect : void ();

Check environment variables HTTP_PROXY, http_proxy, HTTPS_PROXY, https_proxy, NO_PROXY and no_proxy for proxy information. Automatic proxy detection can be enabled with the SPVM_MOJO_PROXY environment variable.

is_needed

method is_needed : int ($domain : string) ;

Check if request for domain would use a proxy server.

prepare

method prepare : void ($tx : Mojo::Transaction::HTTP);

Prepare proxy server information for transaction.

See Also

Copyright & License

Copyright (c) 2025 Yuki Kimoto

MIT License