Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Using URI::URL to determine resources within a site

by Gilimanjaro (Hermit)
on Aug 04, 2004 at 11:00 UTC ( [id://379954]=note: print w/replies, xml ) Need Help??


in reply to Using URI::URL to determine resources within a site

A regular expression can do this, and can handle the case for you:

$match = $url =~ /^$base/i;

That's case insensitive...

But there really is no solution; whether or not the case matters depends on the webserver implementation, and so you can't be sure if you should check for it.

Other tricky stuff can be a double slash after the host part, or anywhere in the url. Most webservers when mapping requests directly to files on the filesystem will find a file with superfluos slashes, but if everything under a certain location is passed to for instance to a custom mod_perl handler, it's completely up to the handler to decide whether the request is ok...

It sort of depends on your exact definition of 'site' and thus 'part of the site' I suppose...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://379954]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2024-04-18 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found