|
|
|
@ -761,12 +761,16 @@ namespace WebSocketSharp.Net
|
|
|
|
|
|
|
|
|
|
|
|
public static string HtmlAttributeEncode (string s)
|
|
|
|
public static string HtmlAttributeEncode (string s)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (s == null || s.Length == 0 || !s.Contains ('&', '"', '<', '>'))
|
|
|
|
if (s == null)
|
|
|
|
return s;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
var output = new StringBuilder ();
|
|
|
|
if (s.Length == 0)
|
|
|
|
foreach (var c in s)
|
|
|
|
return String.Empty;
|
|
|
|
output.Append (
|
|
|
|
|
|
|
|
|
|
|
|
var buff = new StringBuilder ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var c in s) {
|
|
|
|
|
|
|
|
buff.Append (
|
|
|
|
c == '&'
|
|
|
|
c == '&'
|
|
|
|
? "&"
|
|
|
|
? "&"
|
|
|
|
: c == '"'
|
|
|
|
: c == '"'
|
|
|
|
@ -775,9 +779,11 @@ namespace WebSocketSharp.Net
|
|
|
|
? "<"
|
|
|
|
? "<"
|
|
|
|
: c == '>'
|
|
|
|
: c == '>'
|
|
|
|
? ">"
|
|
|
|
? ">"
|
|
|
|
: c.ToString ());
|
|
|
|
: c.ToString ()
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return output.ToString ();
|
|
|
|
return buff.ToString ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void HtmlAttributeEncode (string s, TextWriter output)
|
|
|
|
public static void HtmlAttributeEncode (string s, TextWriter output)
|
|
|
|
|