good url validation.
This commit is contained in:
		
							parent
							
								
									c04ff547ad
								
							
						
					
					
						commit
						514e57768f
					
				| @ -222,9 +222,17 @@ func main() { | ||||
| 	if len(args) != 1 { | ||||
| 		printHelp("") | ||||
| 	} | ||||
| 	validateString(args[0], "wsUrl", `^wss?://[a-zA-Z0-9]*(:[0-9]+)?$`) | ||||
| 
 | ||||
| 	wsURL := args[0] + "/agent/" + id | ||||
| 	wsURL := args[0] | ||||
| 	url, err := url.Parse(wsURL) | ||||
| 	if err != nil { | ||||
| 		printHelp(fmt.Sprintf("Invalid URL %s", wsURL)) | ||||
| 	} | ||||
| 	if url.Path != "" && url.Path != "/" { | ||||
| 		printHelp(fmt.Sprintf("Only a base URL without path may be specified: %s", wsURL)) | ||||
| 	} | ||||
| 
 | ||||
| 	wsURL += "/agent/" + id | ||||
| 
 | ||||
| 	dialer := websocket.Dialer{ | ||||
| 		Proxy:            http.ProxyFromEnvironment, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user