Re: Further enhancements to the URL module

Martijn Koster (m.koster@nexor.co.uk)
Tue, 21 Mar 1995 18:44:47 +0000


> I've taken Martijn's patch to my Friday evening URL.pm and spent a whole
> bunch more hours bashing the escaping and testing into shape.
> 
> This is now looking rather good (IMHO ;-)

Indeed, it's definately getting there. I've got some minor changes
I'll mail you direct in a few minutes.

> I've taken the liberty of calling it URI::URL :-)

Whatever.

> Can we freeze this soon ?

Ehr, I still think the escaping is insufficient, as it doesn't specify
class-specific reserved character sets. Roy wrote:

] Each component of a URL has separate requirements regarding
] what must be escaped, and those requirements are also
] dependent on the URL scheme. 

and rfc1738 specifies different sets of reserved chars.

For example, I think the following test should succeed:

    $url = new URI::URL 'file://h/test?ing';
    $url->_expect('path', 'test?ing');

because:

    fileurl        = "file://" [ host | "localhost" ] "/" fpath
    fpath          = fsegment *[ "/" fsegment ]
    fsegment       = *[ uchar | "?" | ":" | "@" | "&" | "=" ]

The RFC also says:

| On the other hand, characters that are not required to be encoded
| (including alphanumerics) may be encoded within the scheme-specific
| part of a URL, as long as they are not being used for a reserved
| purpose.

Which leaves my to wonder if the following test should not succeed too:

    $url = new URI::URL 'file://h/';
    $url->path('question?mark');
    $url->_expect('str', 'file//h/question?mark');

instead of

    $url->_expect('str', 'file//h/question%3Fmark');

Roy, can you tell me if I'm right or wrong here?

-- Martijn
__________
Internet: m.koster@nexor.co.uk
X-400: C=GB; A= ; P=Nexor; O=Nexor; S=koster; I=M
X-500: c=GB@o=NEXOR Ltd@cn=Martijn Koster
Telephone: +44 115 9 520576
WWW: http://web.nexor.co.uk/users/mak/mak.html