From f6bd88326417c2d53dccc9d9f20bdf04b543e17a Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 16 Aug 2016 17:25:25 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/WebSocket.cs | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 6ffa5307..ae37d480 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -866,6 +866,43 @@ namespace WebSocketSharp return true; } + private static bool checkParametersForSetProxy ( + string url, string username, string password, out string message + ) + { + message = null; + + if (url.IsNullOrEmpty ()) + return true; + + Uri uri; + if (!Uri.TryCreate (url, UriKind.Absolute, out uri) + || uri.Scheme != "http" + || uri.Segments.Length > 1 + ) { + message = "The syntax of a proxy url must be 'http://[:]'."; + return false; + } + + if (username.IsNullOrEmpty ()) + return true; + + if (username.Contains (':') || !username.IsText ()) { + message = "'username' contains an invalid character."; + return false; + } + + if (password.IsNullOrEmpty ()) + return true; + + if (!password.IsText ()) { + message = "'password' contains an invalid character."; + return false; + } + + return true; + } + private bool checkReceivedFrame (WebSocketFrame frame, out string message) { message = null;