Capturing Browser messages instead of sending them??



  • I would like to capture the communication done by the browser (QWebView/QWebPage?) to a "server".
    I plan to modify the TCP connection status to assume it's connected, load some web page HTML (local disk), and change a "write" routine to capture everything sent by the browser after completing some action (request page, get, post, etc.) into a buffer.

    Unfortunately it's pretty difficult to iron this out since Qt is large.
    But I would like to know if this is the right way to do it, and packet capturing won't suit my needs.

    I suppose I should also note that I need to be able to give a custom response to the queries.



  • Hi, ~digmeow00\

    Welcome to Qt Developer Network!

    I can't understand what you want to do. Can you give any example?



  • What you can do is use your own [[doc:QNetworkAccessManager]], and reimplement the virtual createRequest() method. That already allows you introspection of the requests. If you need even more control, you can create your own [[doc:QNetworkReply]] subclass, and return a pointer to an instance of that class from the createRequest() method.

    You can then make the QWebPage use your QNetworkAccessManager (it has a setter for it).



  • I want to tunnel HTTP through a telnet connection.
    My machine connects to the telnet "server", think of this as a simplistic operating system.
    It then asks the machine's operating system to use a telnet client to connect elsewhere, the web.

    An application must act as a man in the middle between browser and connection, hopefully forwarding the requests I capture from the internals of a web browser, and getting forwarded the response information.

    For the local machine I considered running a small web server to host the application.

    Thank you Andre, sounds good.



  • Hmmm... for what you are after, my suggestion is actually useless I think.



  • My plan is to start by capturing a request made by the QWebPage (right class?) into a buffer, and then using the app-in-the-middle to forward the data across the "tunnel", retrieve the responses as necessary, then somehow feed them to the QWebPage.

    An "adapter" pattern would be excellent to use here, but is this possible, and is QWebPage the right class for the job?

    I need the guts of the QT browser features essentially, the part that handles HTTP.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.