Welcome Guest Search | Active Topics | Sign In | Register

HOWTO Intercept all HTTP traffic with EO.WebBroswer. Options
JSB
Posted: Tuesday, July 18, 2017 10:08:47 PM
Rank: Advanced Member
Groups: Member

Joined: 1/2/2017
Posts: 32


Please help,

I want to intercept all HTTP traffic coming from web pages rendered with the EO.WebBroswer, including GET, POST, etc, from the EO.WebBrowser's main HTML-Document, as well as sub-frames, IFRAMES, and Ajax calls. And then, after intercepting them, send back the HTTP/HTML response, as I desire.

To clarify, I want to render back the HTTP/HTML response, from anything the EO.WebBrowser would otherwise get from the actual web server, as if, I were the web server the HTTP call would otherwise have gone to.

It appears the BeforeRequestLoadHandler does capture all HTTP traffic, coming from web pages rendered from the EO.WebBoprswer, including IFRAMES, and jQuery/ajax calls. To clarify, in my testing, with such a handler, I did see the main page, any IFRAMES, js, css, images, all hit my handler, including a jQuery/ajax call. But, this handler does not give the means, to return a rendered HTTP/HTML response, as I would otherwise desire.

Is there a way to do this with EO.WebBrowser?

The above asked; Assuredly, the EO.WebBrowser, has a sequence of events, that lead to the BeforeRequestLoadHandler event, which surely then leads to the actual HTTP request. Thus meaning, the EO.WebBrowser control, must centralize the HTTP request, for the BeforeRequestLoadHandler event, before the actual HTTP request is sent. This can be seen by putting a break point inside the BeforeRequestLoadHandler, and a break point inside one's web server logic, to see, the break point for the BeforeRequestLoadHandler gets called, and BLOCKS, the HTTP request, and until the BeforeRequestLoadHandler is done, the web server's break point, never gets called. Keeping all this in mind, it means, intercepting all HTTP traffic and rendering one's own HTTP/HTML response, is definately doable from EO.WebBroswer, but at the moment, I could only forsee doing this, by hacking.

Any ideas?



eo_support
Posted: Wednesday, July 19, 2017 9:25:21 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

The only way to fully intercept all traffic coming from web pages is to handling the hTTP layer yourself. There are two ways to do this: You can either use a custom resource handler or use a proxy server. A proxy server is a standard component that is out of the scope of our support. You can find more information about custom resource handler here:

https://www.essentialobjects.com/doc/webbrowser/advanced/resource_handler.aspx

BeforeRequestLoad event captures the traffic TO the web server, not the traffic FROM the web server. In another word, it captures the request, not the response. As such response doesn't even have anything to do with BeforeRequestLoad at all.

The part that handles the response from the web server is highly optimized and very closely integrated with the HTML parser/renderer. For example, the HTML parser will start parsing as soon as it receives something. It does not wait until the whole document is received. So there is no single point that you can insert your code to examine what is sent to you from the server and do something about it. Because of this, we only provide very limited routing capabilities. The only event that is raised during the response phase is AfterReceiveHeaders, and you can not modify anything in this event.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.