Hi everyone,

It took me a few days but I managed to implement and thoroughly test
two new validator functions for web2py:

IS_GENERIC_URL: this precisely follows the URL specs (RFC 2396). It
screens out strings with funny characters, and checks the inputed
scheme against an authoritative list of all valid schemes. This
generic function will work to validate ANY protocol that uses URLs.

IS_HTTP_URL: this precisely follows the HTTP protocol URL specs (RFC
2616). It only works for http and https, but it handles all the weird
cases, like relative URLs, abbreviated URLs, ports, localhost, etc.
etc. It checks to make sure the domain makes sense, and it checks the
top-level domain against an authoritative list. If you input an
abbreviated URL, it will prepend "http://"; unless you specify
otherwise when you construct the validator.

As you might guess, successful validations of IS_HTTP_URL are a subset
of what IS_GENERIC_URL validates.

It is not possible to create a version of IS_URL that properly
validates HTTP, FTP and FILE and other schemes, because each scheme is
mutually exclusive as far as I can tell. They each have their own
different syntaxes. Therefore, I suggest that for IS_URL we either:

    (1) Make it into an "umbrella function" that runs a series of
validators one after the other, returning the first that is accepted

OR

    (2) We rename either IS_HTTP_URL or IS_GENERIC_URL to IS_URL,
depending on which one best reflects the desired implementation for
IS_URL


I'm going to try to figure out how to upload my changes to BitBucket
tomorrow. For anyone that would like to see my results immediately,
please just send me an email and I'll be happy to send you the files.


I hope the above helps at least a little,

--Jonathan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to