Skip to content

Commit

Permalink
bump the default user-agent + log its source
Browse files Browse the repository at this point in the history
  • Loading branch information
chocolateboy committed Aug 3, 2020
1 parent 29cf0a7 commit 5b97a1b
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lib/App/Wax.pm
Expand Up @@ -23,19 +23,22 @@ use version; our $VERSION = version->declare('v3.1.2');

# defaults
use constant {
CACHE => 0,
ENV_PROXY => 1,
EXTENSION => qr/.(\.(?:(tar\.(?:bz|bz2|gz|lzo|Z))|(?:[ch]\+\+)|(?:\w+)))$/i,
INDEX => '%s.index.txt',
MIRROR => 0,
NAME => 'wax',
SEPARATOR => '--',
TEMPLATE => 'XXXXXXXX',
TIMEOUT => 60,
USER_AGENT => ($ENV{WAX_USER_AGENT} || 'Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0'),
VERBOSE => 0,
CACHE => 0,
DEFAULT_USER_AGENT => 'Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0',
ENV_PROXY => 1,
ENV_USER_AGENT => $ENV{WAX_USER_AGENT},
EXTENSION => qr/.(\.(?:(tar\.(?:bz|bz2|gz|lzo|Z))|(?:[ch]\+\+)|(?:\w+)))$/i,
INDEX => '%s.index.txt',
MIRROR => 0,
NAME => 'wax',
SEPARATOR => '--',
TEMPLATE => 'XXXXXXXX',
TIMEOUT => 60,
VERBOSE => 0,
};

use constant USER_AGENT => ENV_USER_AGENT || DEFAULT_USER_AGENT;

# RFC 2616: "If the media type remains unknown, the recipient SHOULD treat
# it as type 'application/octet-stream'."
use constant DEFAULT_CONTENT_TYPE => 'application/octet-stream';
Expand Down Expand Up @@ -497,7 +500,8 @@ method _parse ($argv) {
last;
} elsif ($self->is_url($arg)) {
unless ($seen_url) {
$self->debug('user-agent: %s', $self->user_agent);
my $source = ENV_USER_AGENT ? ' (env)' : '';
$self->debug('user-agent%s: %s', $source, $self->user_agent);
$self->debug('timeout: %d', $self->timeout);
$seen_url = 1;
}
Expand Down

0 comments on commit 5b97a1b

Please sign in to comment.