@@ -38,10 +38,6 @@ import UVClient from '../client/index.js';
38
38
import BareClient from '@tomphttp/bare-client' ;
39
39
import EventEmitter from 'events' ;
40
40
41
- const valid_chars =
42
- "!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~" ;
43
- const reserved_chars = '%' ;
44
-
45
41
class Ultraviolet {
46
42
constructor ( options = { } ) {
47
43
this . prefix = options . prefix || '/service/' ;
@@ -133,46 +129,6 @@ class Ultraviolet {
133
129
decodeUrl ( str ) {
134
130
return decodeURIComponent ( str ) ;
135
131
}
136
- encodeProtocol ( protocol ) {
137
- protocol = protocol . toString ( ) ;
138
-
139
- let result = '' ;
140
-
141
- for ( let i = 0 ; i < protocol . length ; i ++ ) {
142
- const char = protocol [ i ] ;
143
-
144
- if ( valid_chars . includes ( char ) && ! reserved_chars . includes ( char ) ) {
145
- result += char ;
146
- } else {
147
- const code = char . charCodeAt ( ) ;
148
- result += '%' + code . toString ( 16 ) . padStart ( 2 , 0 ) ;
149
- }
150
- }
151
-
152
- return result ;
153
- }
154
- decodeProtocol ( protocol ) {
155
- if ( typeof protocol != 'string' )
156
- throw new TypeError ( 'protocol must be a string' ) ;
157
-
158
- let result = '' ;
159
-
160
- for ( let i = 0 ; i < protocol . length ; i ++ ) {
161
- const char = protocol [ i ] ;
162
-
163
- if ( char == '%' ) {
164
- const code = parseInt ( protocol . slice ( i + 1 , i + 3 ) , 16 ) ;
165
- const decoded = String . fromCharCode ( code ) ;
166
-
167
- result += decoded ;
168
- i += 2 ;
169
- } else {
170
- result += char ;
171
- }
172
- }
173
-
174
- return result ;
175
- }
176
132
implementUVMiddleware ( ) {
177
133
// HTML
178
134
attributes ( this ) ;
0 commit comments