开发者

display http blocking page from LSP with chrome

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 sho开发者_如何学Cwing 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.


Chrome uses overlapped I/O, so you need to put your code where WSPRecv is called in overlap.cpp in addition to spi.cpp. (Filenames from the nonifslsp SDK sample.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜