|
|
|
@ -1338,7 +1338,15 @@ namespace WebSocketSharp.Server
|
|
|
|
/// <paramref name="path"/> is <see langword="null"/>.
|
|
|
|
/// <paramref name="path"/> is <see langword="null"/>.
|
|
|
|
/// </exception>
|
|
|
|
/// </exception>
|
|
|
|
/// <exception cref="ArgumentException">
|
|
|
|
/// <exception cref="ArgumentException">
|
|
|
|
/// <paramref name="path"/> is an empty string.
|
|
|
|
/// <para>
|
|
|
|
|
|
|
|
/// <paramref name="path"/> is an empty string.
|
|
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
|
|
/// -or-
|
|
|
|
|
|
|
|
/// </para>
|
|
|
|
|
|
|
|
/// <para>
|
|
|
|
|
|
|
|
/// <paramref name="path"/> is an invalid path.
|
|
|
|
|
|
|
|
/// </para>
|
|
|
|
/// </exception>
|
|
|
|
/// </exception>
|
|
|
|
public byte[] GetFile (string path)
|
|
|
|
public byte[] GetFile (string path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -1348,6 +1356,18 @@ namespace WebSocketSharp.Server
|
|
|
|
if (path.Length == 0)
|
|
|
|
if (path.Length == 0)
|
|
|
|
throw new ArgumentException ("An empty string.", "path");
|
|
|
|
throw new ArgumentException ("An empty string.", "path");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (path.IndexOf (':') > -1)
|
|
|
|
|
|
|
|
throw new ArgumentException ("It contains ':'.", "path");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (path.IndexOf ("..") > -1)
|
|
|
|
|
|
|
|
throw new ArgumentException ("It contains '..'.", "path");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (path.IndexOf ("//") > -1)
|
|
|
|
|
|
|
|
throw new ArgumentException ("It contains '//'.", "path");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (path.IndexOf ("\\\\") > -1)
|
|
|
|
|
|
|
|
throw new ArgumentException ("It contains '\\\\'.", "path");
|
|
|
|
|
|
|
|
|
|
|
|
path = createFilePath (path);
|
|
|
|
path = createFilePath (path);
|
|
|
|
return File.Exists (path) ? File.ReadAllBytes (path) : null;
|
|
|
|
return File.Exists (path) ? File.ReadAllBytes (path) : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|