I have HTTP module that compresses HTTP request.
public override void Write(byte[] buffer, int offset, int count)
{
byte[] data = new byte[count];
Buffer.BlockCopy(buffer, offset, data, 0, count);
string html = System.Text.Encoding.Default.GetString(buffer);
Regex reg = new Regex(@"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}");
html = reg.Replace(html, string.Empty);
byte[] outdata = System.Text.Encoding.Default.GetBytes(html);
_sink.Write(outdata, 0, outdata.GetLength(0));
}
How can I escape all inline scripts? This is my scripts regex.
Regex reg = new Regex("<script[^>]*?>[\\w|\\t|\\r|\\W]*?</script>", (RegexOptions.Singleline | RegexOptions.IgnoreCase));