[Modify] Polish it
This commit is contained in:
parent
36a40ef4ab
commit
babc702f10
@ -172,14 +172,15 @@ namespace WebSocketSharp
|
|||||||
|
|
||||||
internal static byte[] Append (this ushort code, string reason)
|
internal static byte[] Append (this ushort code, string reason)
|
||||||
{
|
{
|
||||||
var ret = code.InternalToByteArray (ByteOrder.Big);
|
var bytes = code.InternalToByteArray (ByteOrder.Big);
|
||||||
if (reason != null && reason.Length > 0) {
|
|
||||||
var buff = new List<byte> (ret);
|
|
||||||
buff.AddRange (Encoding.UTF8.GetBytes (reason));
|
|
||||||
ret = buff.ToArray ();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
if (reason == null || reason.Length == 0)
|
||||||
|
return bytes;
|
||||||
|
|
||||||
|
var buff = new List<byte> (bytes);
|
||||||
|
buff.AddRange (Encoding.UTF8.GetBytes (reason));
|
||||||
|
|
||||||
|
return buff.ToArray ();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void Close (this HttpListenerResponse response, HttpStatusCode code)
|
internal static void Close (this HttpListenerResponse response, HttpStatusCode code)
|
||||||
|
Loading…
Reference in New Issue
Block a user