Fix for the deflate frame

This commit is contained in:
sta
2013-04-23 18:08:42 +09:00
parent df1ff81483
commit b33b5e63ba
81 changed files with 1204 additions and 347 deletions

View File

@@ -549,15 +549,6 @@ namespace WebSocketSharp.Net {
return i ^ (j << 13 | j >> 19) ^ (k << 26 | k >> 6) ^ (l << 7 | l >> 25) ^ (m << 20 | m >> 12);
}
// See para 3.6 of RFC 2616
string Quote (string value)
{
if (version == 0 || value.IsToken ())
return value;
else
return "\"" + value.Replace("\"", "\\\"") + "\"";
}
string ToResponseStringVersion0 ()
{
var result = new StringBuilder (64);
@@ -605,7 +596,7 @@ namespace WebSocketSharp.Net {
result.AppendFormat ("; Comment={0}", comment.UrlEncode ());
if (!commentUri.IsNull ())
result.AppendFormat ("; CommentURL={0}", Quote (commentUri.OriginalString));
result.AppendFormat ("; CommentURL={0}", commentUri.OriginalString.Quote ());
if (discard)
result.Append ("; Discard");

View File

@@ -401,37 +401,7 @@ namespace WebSocketSharp.Net {
static IEnumerable<string> Split (string value)
{
var buffer = new StringBuilder (64);
int len = value.Length;
bool quoted = false;
bool escaped = false;
for (int i = 0; i < len; i++) {
char c = value [i];
if (c == '"') {
if (escaped)
escaped = !escaped;
else
quoted = !quoted;
}
else if (c == '\\') {
if (i < len - 1 && value [i + 1] == '"')
escaped = true;
}
else if (c == ',' || c == ';') {
if (!quoted) {
yield return buffer.ToString ();
buffer.Length = 0;
continue;
}
}
else {
}
buffer.Append (c);
}
if (buffer.Length > 0)
yield return buffer.ToString ();
return value.SplitHeaderValue (',', ';');
}
#endregion