Skip to content

Using some special characters in http authentication broke URI parsing #143

Open
@kastakhov

Description

@kastakhov

URI lib cannot correctly parse next URI if its contain '#/?' symbols.
For instance, next code:

use strict;
use warnings;
use v5.10;

use URI;

my $username = 'u1!"#$%&\'()*+,-./;<=>?@[\]^_`{|}~';
my $password = 'p2!"#$%&\'()*+,-./;<=>?@[\]^_`{|}~';
my $host = 'localhost';
my $port = '8080';

my $uri = URI->new("http://${username}:${password}\@${host}:${port}/path/to/file");
say $uri->scheme;
say $uri->host;
say $uri->port;
say $uri->path;
say $uri->authority;
say $uri->userinfo;

Produce the next output:

me@rogflowx13:~/libwww-perl$ perl test.pl
http
u1!"
80

u1!%22
Use of uninitialized value in say at test.pl line 25.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions