mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 05:31:41 +00:00
update
This commit is contained in:
6
node_modules/valid-url/.jshintrc
generated
vendored
Normal file
6
node_modules/valid-url/.jshintrc
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"node" : true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"indent": 4
|
||||
}
|
5
node_modules/valid-url/.travis.yml
generated
vendored
Normal file
5
node_modules/valid-url/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.6"
|
||||
- "0.8"
|
||||
- "0.10"
|
20
node_modules/valid-url/LICENSE
generated
vendored
Normal file
20
node_modules/valid-url/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright (c) 2013 Odysseas Tsatalos and oDesk Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
10
node_modules/valid-url/Makefile
generated
vendored
Normal file
10
node_modules/valid-url/Makefile
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
TAP=node_modules/.bin/tap
|
||||
LINT=node_modules/.bin/jshint
|
||||
|
||||
test: lint
|
||||
$(TAP) test/*.js
|
||||
|
||||
lint:
|
||||
$(LINT) index.js
|
||||
$(LINT) test/*.js
|
||||
|
134
node_modules/valid-url/README.md
generated
vendored
Normal file
134
node_modules/valid-url/README.md
generated
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
URI validation functions
|
||||
==
|
||||
[](https://travis-ci.org/ogt/valid-url)
|
||||
|
||||
## Synopsis
|
||||
|
||||
Common url validation methods
|
||||
```
|
||||
var validUrl = require('valid-url');
|
||||
|
||||
if (validUrl.isUri(suspect)){
|
||||
console.log('Looks like an URI');
|
||||
} else {
|
||||
console.log('Not a URI');
|
||||
}
|
||||
```
|
||||
|
||||
Replicates the functionality of Richard Sonnen <sonnen@richardsonnen.com> perl module :
|
||||
http://search.cpan.org/~sonnen/Data-Validate-URI-0.01/lib/Data/Validate/URI.pm [full code here](http://anonscm.debian.org/gitweb/?p=users/dom/libdata-validate-uri-perl.git)
|
||||
into a nodejs module. Translated practically line by line from perl.
|
||||
It passes all the original tests.
|
||||
|
||||
## Description
|
||||
|
||||
(copied from original perl module)
|
||||
|
||||
> This module collects common URI validation routines to make input validation, and untainting easier and more readable.
|
||||
> All functions return an untainted value if the test passes, and undef if it fails. This means that you should always check for a defined status explicitly. Don't assume the return will be true.
|
||||
> The value to test is always the first (and often only) argument.
|
||||
> There are a number of other URI validation modules out there as well (see below.) This one focuses on being fast, lightweight, and relatively 'real-world'. i.e. it's good if you want to check user input, and don't need to parse out the URI/URL into chunks.
|
||||
> Right now the module focuses on HTTP URIs, since they're arguably the most common. If you have a specialized scheme you'd like to have supported, let me know.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install valid-url
|
||||
```
|
||||
|
||||
## Methods
|
||||
```javascript
|
||||
/*
|
||||
* @Function isUri(value)
|
||||
*
|
||||
* @Synopsis is the value a well-formed uri?
|
||||
* @Description
|
||||
Returns the untainted URI if the test value appears to be well-formed. Note that
|
||||
you may really want one of the more practical methods like is_http_uri or is_https_uri,
|
||||
since the URI standard (RFC 3986) allows a lot of things you probably don't want.
|
||||
* @Arguments
|
||||
* value The potential URI to test.
|
||||
*
|
||||
* @Returns The untainted RFC 3986 URI on success, undefined on failure.
|
||||
* @Notes
|
||||
This function does not make any attempt to check whether the URI is accessible
|
||||
or 'makes sense' in any meaningful way. It just checks that it is formatted
|
||||
correctly.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @Function isHttpUri(value)
|
||||
* @Synopsis is the value a well-formed HTTP uri?
|
||||
* @Description
|
||||
Specialized version of isUri() that only likes http:// urls. As a result, it can
|
||||
also do a much more thorough job validating. Also, unlike isUri() it is more
|
||||
concerned with only allowing real-world URIs through. Things like relative
|
||||
hostnames are allowed by the standards, but probably aren't wise. Conversely,
|
||||
null paths aren't allowed per RFC 2616 (should be '/' instead), but are allowed
|
||||
by this function.
|
||||
|
||||
This function only works for fully-qualified URIs. /bob.html won't work.
|
||||
See RFC 3986 for the appropriate method to turn a relative URI into an absolute
|
||||
one given its context.
|
||||
|
||||
Returns the untainted URI if the test value appears to be well-formed.
|
||||
|
||||
Note that you probably want to either call this in combo with is_https_uri(). i.e.
|
||||
|
||||
if(isHttpUri(uri) || isHttpsUri(uri)) console.log('Good');
|
||||
|
||||
or use the convenience method isWebUri which is equivalent.
|
||||
|
||||
* @Arguments
|
||||
* value The potential URI to test.
|
||||
*
|
||||
* @Returns The untainted RFC 3986 URI on success, undefined on failure.
|
||||
* @Notes
|
||||
This function does not make any attempt to check whether the URI is accessible
|
||||
or 'makes sense' in any meaningful way. It just checks that it is formatted
|
||||
correctly.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @Function isHttpsUri(value)
|
||||
* @Synopsis is the value a well-formed HTTPS uri?
|
||||
* @Description
|
||||
See is_http_uri() for details. This version only likes the https URI scheme.
|
||||
Otherwise it's identical to is_http_uri()
|
||||
* @Arguments
|
||||
* value The potential URI to test.
|
||||
*
|
||||
* @Returns The untainted RFC 3986 URI on success, undefined on failure.
|
||||
* @Notes
|
||||
This function does not make any attempt to check whether the URI is accessible
|
||||
or 'makes sense' in any meaningful way. It just checks that it is formatted
|
||||
correctly.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @Function isWebUri(value)
|
||||
* @Synopsis is the value a well-formed HTTP or HTTPS uri?
|
||||
* @Description
|
||||
This is just a convenience method that combines isHttpUri and isHttpsUri
|
||||
to accept most common real-world URLs.
|
||||
* @Arguments
|
||||
* value The potential URI to test.
|
||||
*
|
||||
* @Returns The untainted RFC 3986 URI on success, undefined on failure.
|
||||
* @Notes
|
||||
This function does not make any attempt to check whether the URI is accessible
|
||||
or 'makes sense' in any meaningful way. It just checks that it is formatted
|
||||
correctly.
|
||||
*/
|
||||
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
RFC 3986, RFC 3966, RFC 4694, RFC 4759, RFC 4904
|
||||
|
153
node_modules/valid-url/index.js
generated
vendored
Normal file
153
node_modules/valid-url/index.js
generated
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
(function(module) {
|
||||
'use strict';
|
||||
|
||||
module.exports.is_uri = is_iri;
|
||||
module.exports.is_http_uri = is_http_iri;
|
||||
module.exports.is_https_uri = is_https_iri;
|
||||
module.exports.is_web_uri = is_web_iri;
|
||||
// Create aliases
|
||||
module.exports.isUri = is_iri;
|
||||
module.exports.isHttpUri = is_http_iri;
|
||||
module.exports.isHttpsUri = is_https_iri;
|
||||
module.exports.isWebUri = is_web_iri;
|
||||
|
||||
|
||||
// private function
|
||||
// internal URI spitter method - direct from RFC 3986
|
||||
var splitUri = function(uri) {
|
||||
var splitted = uri.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);
|
||||
return splitted;
|
||||
};
|
||||
|
||||
function is_iri(value) {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check for illegal characters
|
||||
if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(value)) return;
|
||||
|
||||
// check for hex escapes that aren't complete
|
||||
if (/%[^0-9a-f]/i.test(value)) return;
|
||||
if (/%[0-9a-f](:?[^0-9a-f]|$)/i.test(value)) return;
|
||||
|
||||
var splitted = [];
|
||||
var scheme = '';
|
||||
var authority = '';
|
||||
var path = '';
|
||||
var query = '';
|
||||
var fragment = '';
|
||||
var out = '';
|
||||
|
||||
// from RFC 3986
|
||||
splitted = splitUri(value);
|
||||
scheme = splitted[1];
|
||||
authority = splitted[2];
|
||||
path = splitted[3];
|
||||
query = splitted[4];
|
||||
fragment = splitted[5];
|
||||
|
||||
// scheme and path are required, though the path can be empty
|
||||
if (!(scheme && scheme.length && path.length >= 0)) return;
|
||||
|
||||
// if authority is present, the path must be empty or begin with a /
|
||||
if (authority && authority.length) {
|
||||
if (!(path.length === 0 || /^\//.test(path))) return;
|
||||
} else {
|
||||
// if authority is not present, the path must not start with //
|
||||
if (/^\/\//.test(path)) return;
|
||||
}
|
||||
|
||||
// scheme must begin with a letter, then consist of letters, digits, +, ., or -
|
||||
if (!/^[a-z][a-z0-9\+\-\.]*$/.test(scheme.toLowerCase())) return;
|
||||
|
||||
// re-assemble the URL per section 5.3 in RFC 3986
|
||||
out += scheme + ':';
|
||||
if (authority && authority.length) {
|
||||
out += '//' + authority;
|
||||
}
|
||||
|
||||
out += path;
|
||||
|
||||
if (query && query.length) {
|
||||
out += '?' + query;
|
||||
}
|
||||
|
||||
if (fragment && fragment.length) {
|
||||
out += '#' + fragment;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
function is_http_iri(value, allowHttps) {
|
||||
if (!is_iri(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var splitted = [];
|
||||
var scheme = '';
|
||||
var authority = '';
|
||||
var path = '';
|
||||
var port = '';
|
||||
var query = '';
|
||||
var fragment = '';
|
||||
var out = '';
|
||||
|
||||
// from RFC 3986
|
||||
splitted = splitUri(value);
|
||||
scheme = splitted[1];
|
||||
authority = splitted[2];
|
||||
path = splitted[3];
|
||||
query = splitted[4];
|
||||
fragment = splitted[5];
|
||||
|
||||
if (!scheme) return;
|
||||
|
||||
if(allowHttps) {
|
||||
if (scheme.toLowerCase() != 'https') return;
|
||||
} else {
|
||||
if (scheme.toLowerCase() != 'http') return;
|
||||
}
|
||||
|
||||
// fully-qualified URIs must have an authority section that is
|
||||
// a valid host
|
||||
if (!authority) {
|
||||
return;
|
||||
}
|
||||
|
||||
// enable port component
|
||||
if (/:(\d+)$/.test(authority)) {
|
||||
port = authority.match(/:(\d+)$/)[0];
|
||||
authority = authority.replace(/:\d+$/, '');
|
||||
}
|
||||
|
||||
out += scheme + ':';
|
||||
out += '//' + authority;
|
||||
|
||||
if (port) {
|
||||
out += port;
|
||||
}
|
||||
|
||||
out += path;
|
||||
|
||||
if(query && query.length){
|
||||
out += '?' + query;
|
||||
}
|
||||
|
||||
if(fragment && fragment.length){
|
||||
out += '#' + fragment;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
function is_https_iri(value) {
|
||||
return is_http_iri(value, true);
|
||||
}
|
||||
|
||||
function is_web_iri(value) {
|
||||
return (is_http_iri(value) || is_https_iri(value));
|
||||
}
|
||||
|
||||
})(module);
|
56
node_modules/valid-url/package.json
generated
vendored
Normal file
56
node_modules/valid-url/package.json
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"valid-url@1.0.9",
|
||||
"/Users/tatiana/selfdefined"
|
||||
]
|
||||
],
|
||||
"_from": "valid-url@1.0.9",
|
||||
"_id": "valid-url@1.0.9",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA=",
|
||||
"_location": "/valid-url",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "valid-url@1.0.9",
|
||||
"name": "valid-url",
|
||||
"escapedName": "valid-url",
|
||||
"rawSpec": "1.0.9",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.9"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@11ty/eleventy"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/valid-url/-/valid-url-1.0.9.tgz",
|
||||
"_spec": "1.0.9",
|
||||
"_where": "/Users/tatiana/selfdefined",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ogt/valid-url/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "URI validation functions",
|
||||
"devDependencies": {
|
||||
"jshint": "~2.1.4",
|
||||
"tap": "~0.4.3"
|
||||
},
|
||||
"homepage": "https://github.com/ogt/valid-url#readme",
|
||||
"keywords": [
|
||||
"url",
|
||||
"validation",
|
||||
"check",
|
||||
"checker",
|
||||
"pattern"
|
||||
],
|
||||
"main": "index.js",
|
||||
"name": "valid-url",
|
||||
"repository": {
|
||||
"url": "git://github.com/ogt/valid-url.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "1.0.9"
|
||||
}
|
22
node_modules/valid-url/test/is_http_uri.js
generated
vendored
Normal file
22
node_modules/valid-url/test/is_http_uri.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
var test = require("tap").test,
|
||||
is_http_uri = require('../').is_http_uri;
|
||||
|
||||
test("testing is_http_uri", function (t) {
|
||||
|
||||
// valid
|
||||
t.ok(is_http_uri('http://www.richardsonnen.com/'), 'http://www.richardsonnen.com/');
|
||||
t.ok(is_http_uri('http://www.richardsonnen.com'), 'http://www.richardsonnen.com');
|
||||
t.ok(is_http_uri('http://www.richardsonnen.com/foo/bar/test.html'), 'http://www.richardsonnen.com/foo/bar/test.html');
|
||||
t.ok(is_http_uri('http://www.richardsonnen.com/?foo=bar'), 'http://www.richardsonnen.com/?foo=bar');
|
||||
t.ok(is_http_uri('http://www.richardsonnen.com:8080/test.html'), 'http://www.richardsonnen.com:8080/test.html');
|
||||
t.ok(is_http_uri('http://example.w3.org/path%20with%20spaces.html'), 'http://example.w3.org/path%20with%20spaces.html');
|
||||
t.ok(is_http_uri('http://192.168.0.1/'), 'http://192.168.0.1/');
|
||||
|
||||
// invalid
|
||||
t.notOk(is_http_uri(''), "bad: ''");
|
||||
t.notOk(is_http_uri('ftp://ftp.richardsonnen.com'), "bad: 'ftp://ftp.richardsonnen.com'");
|
||||
t.notOk(is_http_uri('http:www.richardsonnen.com'), "bad: 'http:www.richardsonnen.com'");
|
||||
t.notOk(is_http_uri('https://www.richardsonnen.com'), "bad: 'https://www.richardsonnen.com'");
|
||||
|
||||
t.end();
|
||||
});
|
22
node_modules/valid-url/test/is_https_uri.js
generated
vendored
Normal file
22
node_modules/valid-url/test/is_https_uri.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
var test = require("tap").test,
|
||||
is_https_uri = require('../').is_https_uri;
|
||||
|
||||
test("testing is_https_uri", function (t) {
|
||||
|
||||
// valid
|
||||
t.ok(is_https_uri('https://www.richardsonnen.com/'), 'https://www.richardsonnen.com/');
|
||||
t.ok(is_https_uri('https://www.richardsonnen.com'), 'https://www.richardsonnen.com');
|
||||
t.ok(is_https_uri('https://www.richardsonnen.com/foo/bar/test.html'), 'https://www.richardsonnen.com/foo/bar/test.html');
|
||||
t.ok(is_https_uri('https://www.richardsonnen.com/?foo=bar'), 'https://www.richardsonnen.com/?foo=bar');
|
||||
t.ok(is_https_uri('https://www.richardsonnen.com:8080/test.html'), 'https://www.richardsonnen.com:8080/test.html');
|
||||
t.ok(is_https_uri('https://example.w3.org/path%20with%20spaces.html'), 'http://example.w3.org/path%20with%20spaces.html');
|
||||
t.ok(is_https_uri('https://192.168.0.1/'), 'http://192.168.0.1/');
|
||||
|
||||
// invalid
|
||||
t.notOk(is_https_uri(''), "bad: ''");
|
||||
t.notOk(is_https_uri('http://www.richardsonnen.com/'), 'http://www.richardsonnen.com/');
|
||||
t.notOk(is_https_uri('ftp://ftp.richardsonnen.com'), "bad: 'ftp://ftp.richardsonnen.com'");
|
||||
t.notOk(is_https_uri('https:www.richardsonnen.com'), "bad: 'https:www.richardsonnen.com'");
|
||||
|
||||
t.end();
|
||||
});
|
35
node_modules/valid-url/test/is_uri.js
generated
vendored
Normal file
35
node_modules/valid-url/test/is_uri.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
var test = require("tap").test,
|
||||
is_uri = require('../').is_uri;
|
||||
|
||||
test("testing is_uri", function (t) {
|
||||
|
||||
// valid - from RFC 3986 for the most part
|
||||
t.ok(is_uri('http://localhost/'), 'http://localhost/');
|
||||
t.ok(is_uri('http://example.w3.org/path%20with%20spaces.html'), 'http://example.w3.org/path%20with%20spaces.html');
|
||||
t.ok(is_uri('http://example.w3.org/%20'), 'http://example.w3.org/%20');
|
||||
t.ok(is_uri('ftp://ftp.is.co.za/rfc/rfc1808.txt'), 'ftp://ftp.is.co.za/rfc/rfc1808.txt');
|
||||
t.ok(is_uri('ftp://ftp.is.co.za/../../../rfc/rfc1808.txt'), 'ftp://ftp.is.co.za/../../../rfc/rfc1808.txt');
|
||||
t.ok(is_uri('http://www.ietf.org/rfc/rfc2396.txt'), 'http://www.ietf.org/rfc/rfc2396.txt');
|
||||
t.ok(is_uri('ldap://[2001:db8::7]/c=GB?objectClass?one'), 'ldap://[2001:db8::7]/c=GB?objectClass?one');
|
||||
t.ok(is_uri('mailto:John.Doe@example.com'), 'mailto:John.Doe@example.com');
|
||||
t.ok(is_uri('news:comp.infosystems.www.servers.unix'), 'news:comp.infosystems.www.servers.unix');
|
||||
t.ok(is_uri('tel:+1-816-555-1212'), 'tel:+1-816-555-1212');
|
||||
t.ok(is_uri('telnet://192.0.2.16:80/'), 'telnet://192.0.2.16:80/');
|
||||
t.ok(is_uri('urn:oasis:names:specification:docbook:dtd:xml:4.1.2'), 'urn:oasis:names:specification:docbook:dtd:xml:4.1.2');
|
||||
|
||||
|
||||
// invalid
|
||||
t.notOk(is_uri(''), "bad: ''");
|
||||
t.notOk(is_uri('foo'), 'bad: foo');
|
||||
t.notOk(is_uri('foo@bar'), 'bad: foo@bar');
|
||||
t.notOk(is_uri('http://<foo>'), 'bad: http://<foo>'); // illegal characters
|
||||
t.notOk(is_uri('://bob/'), 'bad: ://bob/'); // empty schema
|
||||
t.notOk(is_uri('1http://bob'), 'bad: 1http://bob/'); // bad schema
|
||||
t.notOk(is_uri('1http:////foo.html'), 'bad: 1http://bob/'); // bad path
|
||||
t.notOk(is_uri('http://example.w3.org/%illegal.html'), 'http://example.w3.org/%illegal.html');
|
||||
t.notOk(is_uri('http://example.w3.org/%a'), 'http://example.w3.org/%a'); // partial escape
|
||||
t.notOk(is_uri('http://example.w3.org/%a/foo'), 'http://example.w3.org/%a/foo'); // partial escape
|
||||
t.notOk(is_uri('http://example.w3.org/%at'), 'http://example.w3.org/%at'); // partial escape
|
||||
|
||||
t.end();
|
||||
});
|
28
node_modules/valid-url/test/is_web_uri.js
generated
vendored
Normal file
28
node_modules/valid-url/test/is_web_uri.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
var test = require("tap").test,
|
||||
is_web_uri = require('../').is_web_uri;
|
||||
|
||||
test("testing is_web_uri", function (t) {
|
||||
|
||||
// valid
|
||||
t.ok(is_web_uri('https://www.richardsonnen.com/'), 'https://www.richardsonnen.com/');
|
||||
t.ok(is_web_uri('https://www.richardsonnen.com'), 'https://www.richardsonnen.com');
|
||||
t.ok(is_web_uri('https://www.richardsonnen.com/foo/bar/test.html'), 'https://www.richardsonnen.com/foo/bar/test.html');
|
||||
t.ok(is_web_uri('https://www.richardsonnen.com/?foo=bar'), 'https://www.richardsonnen.com/?foo=bar');
|
||||
t.ok(is_web_uri('https://www.richardsonnen.com:8080/test.html'), 'https://www.richardsonnen.com:8080/test.html');
|
||||
t.ok(is_web_uri('http://www.richardsonnen.com/'), 'http://www.richardsonnen.com/');
|
||||
t.ok(is_web_uri('http://www.richardsonnen.com'), 'http://www.richardsonnen.com');
|
||||
t.ok(is_web_uri('http://www.richardsonnen.com/foo/bar/test.html'), 'http://www.richardsonnen.com/foo/bar/test.html');
|
||||
t.ok(is_web_uri('http://www.richardsonnen.com/?foo=bar'), 'http://www.richardsonnen.com/?foo=bar');
|
||||
t.ok(is_web_uri('http://www.richardsonnen.com:8080/test.html'), 'http://www.richardsonnen.com:8080/test.html');
|
||||
t.ok(is_web_uri('http://example.w3.org/path%20with%20spaces.html'), 'http://example.w3.org/path%20with%20spaces.html');
|
||||
t.ok(is_web_uri('http://192.168.0.1/'), 'http://192.168.0.1/');
|
||||
|
||||
// invalid
|
||||
t.ok(!is_web_uri(''), "bad: ''");
|
||||
t.ok(!is_web_uri('ftp://ftp.richardsonnen.com'), "bad: 'ftp://ftp.richardsonnen.com'");
|
||||
t.ok(!is_web_uri('https:www.richardsonnen.com'), "bad: 'http:www.richardsonnen.com'");
|
||||
t.ok(!is_web_uri('http:www.richardsonnen.com'), "bad: 'http:www.richardsonnen.com'");
|
||||
|
||||
|
||||
t.end();
|
||||
});
|
Reference in New Issue
Block a user