diff --git a/src/rewrite/index.js b/src/rewrite/index.js index d854b41..2eda082 100644 --- a/src/rewrite/index.js +++ b/src/rewrite/index.js @@ -38,10 +38,6 @@ import UVClient from '../client/index.js'; import BareClient from '@tomphttp/bare-client'; import EventEmitter from 'events'; -const valid_chars = - "!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~"; -const reserved_chars = '%'; - class Ultraviolet { constructor(options = {}) { this.prefix = options.prefix || '/service/'; @@ -133,46 +129,6 @@ class Ultraviolet { decodeUrl(str) { return decodeURIComponent(str); } - encodeProtocol(protocol) { - protocol = protocol.toString(); - - let result = ''; - - for (let i = 0; i < protocol.length; i++) { - const char = protocol[i]; - - if (valid_chars.includes(char) && !reserved_chars.includes(char)) { - result += char; - } else { - const code = char.charCodeAt(); - result += '%' + code.toString(16).padStart(2, 0); - } - } - - return result; - } - decodeProtocol(protocol) { - if (typeof protocol != 'string') - throw new TypeError('protocol must be a string'); - - let result = ''; - - for (let i = 0; i < protocol.length; i++) { - const char = protocol[i]; - - if (char == '%') { - const code = parseInt(protocol.slice(i + 1, i + 3), 16); - const decoded = String.fromCharCode(code); - - result += decoded; - i += 2; - } else { - result += char; - } - } - - return result; - } implementUVMiddleware() { // HTML attributes(this);