@@ -296,21 +296,43 @@ Future<ProxyServer> setupProxyServer({ipV6 = false}) {
296
296
testInvalidProxy () {
297
297
HttpClient client = new HttpClient (context: clientContext);
298
298
299
+ // User without password.
300
+ client.findProxy = (Uri uri) => "PROXY user@localhost:80" ;
301
+ Future <HttpClientRequest ?>.value (
302
+ client.getUrl (Uri .parse ("http://www.google.com/test" )),
303
+ ).catchError ((error) {}, test: (e) => e is HttpException );
304
+
305
+ // User with empty password.
306
+ client.findProxy = (Uri uri) => "PROXY user:@localhost:80" ;
307
+ Future <HttpClientRequest ?>.value (
308
+ client.getUrl (Uri .parse ("http://www.google.com/test" )),
309
+ ).catchError ((error) {}, test: (e) => e is HttpException );
310
+
311
+ // User but no username.
312
+ client.findProxy = (Uri uri) => "PROXY :password@localhost:80" ;
313
+ Future <HttpClientRequest ?>.value (
314
+ client.getUrl (Uri .parse ("http://www.google.com/test" )),
315
+ ).catchError ((error) {}, test: (e) => e is HttpException );
316
+
317
+ // Empty proxy configuration.
299
318
client.findProxy = (Uri uri) => "" ;
300
319
Future <HttpClientRequest ?>.value (
301
320
client.getUrl (Uri .parse ("http://www.google.com/test" )),
302
321
).catchError ((error) {}, test: (e) => e is HttpException );
303
322
323
+ // No 'PROXY' prefix.
304
324
client.findProxy = (Uri uri) => "XXX" ;
305
325
Future <HttpClientRequest ?>.value (
306
326
client.getUrl (Uri .parse ("http://www.google.com/test" )),
307
327
).catchError ((error) {}, test: (e) => e is HttpException );
308
328
329
+ // No port.
309
330
client.findProxy = (Uri uri) => "PROXY www.google.com" ;
310
331
Future <HttpClientRequest ?>.value (
311
332
client.getUrl (Uri .parse ("http://www.google.com/test" )),
312
333
).catchError ((error) {}, test: (e) => e is HttpException );
313
334
335
+ // Port string is non an integer.
314
336
client.findProxy = (Uri uri) => "PROXY www.google.com:http" ;
315
337
Future <HttpClientRequest ?>.value (
316
338
client.getUrl (Uri .parse ("http://www.google.com/test" )),
0 commit comments