diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs
index e37c5d8f..7d594e23 100644
--- a/websocket-sharp/Ext.cs
+++ b/websocket-sharp/Ext.cs
@@ -746,6 +746,21 @@ namespace WebSocketSharp
: !headers.Contains ("Connection", "close", comparison);
}
+ internal static bool MaybeUri (this string value)
+ {
+ var idx = value.IndexOf (':');
+
+ if (idx == -1)
+ return false;
+
+ if (idx >= 10)
+ return false;
+
+ var schm = value.Substring (0, idx);
+
+ return schm.isPredefinedScheme ();
+ }
+
internal static string Quote (this string value)
{
return String.Format ("\"{0}\"", value.Replace ("\"", "\\\""));
@@ -1557,37 +1572,6 @@ namespace WebSocketSharp
return value == null || value.Length == 0;
}
- ///
- /// Determines whether the specified string is a URI string.
- ///
- ///
- /// true if may be a URI string;
- /// otherwise, false.
- ///
- ///
- /// A to test.
- ///
- public static bool MaybeUri (this string value)
- {
- if (value == null)
- return false;
-
- if (value.Length == 0)
- return false;
-
- var idx = value.IndexOf (':');
-
- if (idx == -1)
- return false;
-
- if (idx >= 10)
- return false;
-
- var schm = value.Substring (0, idx);
-
- return schm.isPredefinedScheme ();
- }
-
///
/// Retrieves a sub-array from the specified array. A sub-array starts at
/// the specified index in the array.
@@ -1911,6 +1895,9 @@ namespace WebSocketSharp
///
public static Uri ToUri (this string value)
{
+ if (value == null || value.Length == 0)
+ return null;
+
var kind = value.MaybeUri () ? UriKind.Absolute : UriKind.Relative;
Uri ret;