@@ -296,21 +296,43 @@ Future<ProxyServer> setupProxyServer({ipV6 = false}) {
296296testInvalidProxy () {
297297 HttpClient client = new HttpClient (context: clientContext);
298298
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.
299318 client.findProxy = (Uri uri) => "" ;
300319 Future <HttpClientRequest ?>.value (
301320 client.getUrl (Uri .parse ("http://www.google.com/test" )),
302321 ).catchError ((error) {}, test: (e) => e is HttpException );
303322
323+ // No 'PROXY' prefix.
304324 client.findProxy = (Uri uri) => "XXX" ;
305325 Future <HttpClientRequest ?>.value (
306326 client.getUrl (Uri .parse ("http://www.google.com/test" )),
307327 ).catchError ((error) {}, test: (e) => e is HttpException );
308328
329+ // No port.
309330 client.findProxy = (Uri uri) => "PROXY www.google.com" ;
310331 Future <HttpClientRequest ?>.value (
311332 client.getUrl (Uri .parse ("http://www.google.com/test" )),
312333 ).catchError ((error) {}, test: (e) => e is HttpException );
313334
335+ // Port string is non an integer.
314336 client.findProxy = (Uri uri) => "PROXY www.google.com:http" ;
315337 Future <HttpClientRequest ?>.value (
316338 client.getUrl (Uri .parse ("http://www.google.com/test" )),
0 commit comments