Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use pAPP to modify url in Igor's pApp.

25 views
Skip to first unread message

smooth connection

unread,
Dec 6, 2012, 5:28:24 AM12/6/12
to
Hi, I am playing with Igor's pAPP toolkit sample code.
My goal is intercept http request, then change it to another url.
Say from http://www.google.com to http://www.yahoo.com
I did the change in Start() method, and below is the piece of the code:

template <class StartPolicy, class ThreadModel>
inline STDMETHODIMP CInternetProtocol<StartPolicy, ThreadModel>::Start(
LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink,
IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
{

ATLASSERT(m_spInternetProtocol != 0);
if (!m_spInternetProtocol)
{
return E_UNEXPECTED;
}

//Here is my addition
static bool b = false;
if (!b)
{
b = true;
szUrl = L"http://www.google.com";
}
//end of addition
return StartPolicy::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInternetProtocol);
}

But it never works. Only first request is send as google, and all the sub request is still from yahoo.com. and the browser control cannot show the right page.

Did I miss something?

Another related question: if i also want to modify the cookie with my own one and send along with modified url, where is the right place to add the cookie?

Thanks,
smoothconnection
I
0 new messages