|  | @@ -129,6 +129,7 @@ fn setup(args: &[String]) -> Setup {
 | 
	
		
			
				|  |  |          .optopt("u", "username", "Username to sign in with", "USERNAME")
 | 
	
		
			
				|  |  |          .optopt("p", "password", "Password", "PASSWORD")
 | 
	
		
			
				|  |  |          .optopt("", "proxy", "HTTP proxy to use when connecting", "PROXY")
 | 
	
		
			
				|  |  | +        .optopt("", "ap-port", "Connect to AP with specified port. If no AP with that port are present fallback AP will be used. Available ports are usually 80, 443 and 4070", "AP_PORT")
 | 
	
		
			
				|  |  |          .optflag("", "disable-discovery", "Disable discovery mode")
 | 
	
		
			
				|  |  |          .optopt(
 | 
	
		
			
				|  |  |              "",
 | 
	
	
		
			
				|  | @@ -255,20 +256,23 @@ fn setup(args: &[String]) -> Setup {
 | 
	
		
			
				|  |  |              proxy: matches.opt_str("proxy").or(std::env::var("http_proxy").ok()).map(
 | 
	
		
			
				|  |  |                  |s| {
 | 
	
		
			
				|  |  |                      match Url::parse(&s) {
 | 
	
		
			
				|  |  | -                Ok(url) => {
 | 
	
		
			
				|  |  | -                    if url.host().is_none() || url.port().is_none() {
 | 
	
		
			
				|  |  | -                        panic!("Invalid proxy url, only urls on the format \"http://host:port\" are allowed");
 | 
	
		
			
				|  |  | +                        Ok(url) => {
 | 
	
		
			
				|  |  | +                            if url.host().is_none() || url.port().is_none() {
 | 
	
		
			
				|  |  | +                                panic!("Invalid proxy url, only urls on the format \"http://host:port\" are allowed");
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                            if url.scheme() != "http" {
 | 
	
		
			
				|  |  | +                                panic!("Only unsecure http:// proxies are supported");
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            url
 | 
	
		
			
				|  |  | +                        },
 | 
	
		
			
				|  |  | +                    Err(err) => panic!("Invalid proxy url: {}, only urls on the format \"http://host:port\" are allowed", err)
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                    if url.scheme() != "http" {
 | 
	
		
			
				|  |  | -                        panic!("Only unsecure http:// proxies are supported");
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    url
 | 
	
		
			
				|  |  | -                },
 | 
	
		
			
				|  |  | -                Err(err) => panic!("Invalid proxy url: {}, only urls on the format \"http://host:port\" are allowed", err)
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  |                  },
 | 
	
		
			
				|  |  |              ),
 | 
	
		
			
				|  |  | +            ap_port: matches
 | 
	
		
			
				|  |  | +                .opt_str("ap-port")
 | 
	
		
			
				|  |  | +                .map(|port| port.parse::<u16>().expect("Invalid port")),
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 |