The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Google::SafeBrowsing4::URI - URI management Class for the Google SafeBrowsing (version 4) API.

SYNOPSIS

        use Net::Google::SafeBrowsing4::URI;

        my $gsb_uri = Net::Google::SafeBrowsing4::URI->new('http://my.example.site:80/path/to/file.html?query=param#fragment');
        my @uris = $gsb_uri->generate_lookupuris();

DESCRIPTION

Net::Google::SafeBrowsing4::URI takes care of normalizing URLs, extracting suffix/prefix expressions, calculating hashes.

METHODS

new
        my $gsb_uri = Net::Google::SafeBrowsing4::URI->new('http://my.example.site:80/path/to/file.html?query=param#fragment');

    Initializes the object.

    Arguments:

    $uri The URL to parse
as_string

Returns the normalized URI as string.

generate_lookupuris

Generates all partial/full URIs supported by Google SafeBrowsing. See "suffix/prefix expressions" topic in GSBv4 API reference. Returns a list of Net::Google::SafeBrowsing4::URI objects.

hash

Generates the SHA-256 hash of the URI (with scheme removed).

PRIVATE METHODS

_normalize

Parses and normalizes the URI.

PRIVATE FUNCTIONS

_normalize_ip

Function for recognising various IPv4 formatted addresses and convert them to dotted-decimal-quad format (111.11.1.1)

Arguments:

$host

Hostname to parse as IP Address

_parse_ipv4_segment
        my $decimal = _parse_ipv4_part($segment, $bits)

    Transforms one IPv4 segment to decimal with range checking.

    Arguments:

    $segment

    Decimal/octal/hexadecimal value to parse

    $bits

    Bit length for range checking

BUGS

Some URI normalizatuion cases are still missing:

Highbit characters in hostname are punycoded, not percent encoded.

Google's GO Client percent-escapes based on the hostname is a valid unicode string or not

AUTHORS

Tamás Fehérvári, <geever@users.sourceforge.net<gt> Julien Sobrier, <julien@sobrier.net>,

COPYRIGHT AND LICENSE

Copyright (C) 2016 by Julien Sobrier, Tamás Fehérvári

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 86:

'=item' outside of any '=over'

Around line 154:

You forgot a '=back' before '=head1'