I have modified Microsoft's LSP (Winsosk Layered Service Provider) example to make web filter application for desktop. I am able to block access to websites by comparing host in http header to a list of banned websites in a file. If a web is blocked, LSP will fill the buffer with html page showing that this page is banned. I tested on Firefox 4, Opera 11 and IE 6, and a block page is shown. However, such page not shown in Chrome 11 (the latest).
I wondered if Chrome handle LSP differently.
This is buffer that I feed into LSP WSPRecv function.
string strBufferHdr;
char len[10];
_itoa_s (strBufferHTML.size(), len, 10);
strBufferHdr += "HTTP/1.1 200 OK\r\n";
strBufferHdr += "content-type: text/html; charset=UTF-8\r\n";
strBufferHdr += "connection: close\r\n";
strBufferHdr += "content-length: ";
strBufferHdr += len;
strBufferHdr += "\r\n\r\n";
strBufferHdr += strBufferHTML;
strBufferHdr += "\n\n\n";
strBufferHTML is a html page content.
Thank you.