Re: Alter querystring through APP



Max K. <maxkl@xxxxxxxxxxxxx> wrote:
While using Igor's Passthru APP I need to add a querystring to a
requested url.
In my Start() method I am appending the querystring to szUrl
parameter and calling target app's Start() method with the new URL
with querystring. The request gets sent with the new url.

STDMETHODIMP CTestAPP::Start(
LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink,
IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)

{
LPCWSTR szUrlQuery = szUrl + querystring //add querystring to url

This is pseudocode, right? It doesn't make sense as actual code.

targetApp -> Start(szUrlQuery, ...) //call target app's start with new
url
}

In my ReportData() method my App calls targetSink's ReportProgress
method with BINDSTATUS_REDIRECTING flag with the new URL (szUrlQuery)
to notify the request URL had been changed.

STDMETHODIMP CTestSink::ReportData(
/* [in] */ DWORD grfBSCF,
/* [in] */ ULONG ulProgress,
/* [in] */ ULONG ulProgressMax)
{

m_spInternetProtocolSink->ReportProgress(BINDSTATUS_REDIRECTING,
szUrlQuery); //notify redirect with new URL with querystring

Move that to Start, right before calling Start on target APP. ReportData
is called multiple times, you don't want to report
BINDSTATUS_REDIRECTING more than once.

m_spInternetProtocolSink->ReportData((BSCF_FIRSTDATANOTIFICATION |
BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE), dwLegth,
dwLegth); //notify target sink of data

You tell the client that data is fully avaialble. Is it? How do you know
it is? What makes you so sure the target APP will give you all the data
in one big chunk? Why don't you just pass along the same parameters you
got?

hr = m_spInternetProtocolSink->ReportResult(S_OK, S_OK, NULL);

Same question - when the first ReportData arrives, what makes you so
sure the result is going to be OK? That the connection won't get dropped
before the next chunk of data makes it to you?

However, when I submit the form, that is suppose to request the same
URL+ querystring, the browser sends to APP a request without the
querystring. Why does this happen?

POST requests don't encode form parameters into the URL, but send them
as POST data. What does the <form> tag look like for the form you are
submitting? In particular, what is the method= attribute set to?

If I ignore this problem and have my APP add the querystring to the
URL on the second request

What do you mean by "second request"? I assume there's also a "first"?
How do the two differ?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • Re: Alter querystring through APP
    ... In my Startmethod I am appending the querystring to szUrl ... The request gets sent with the new url. ... right before calling Start on target APP. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • (CORRECTION) memory leak and eventual DOS when calling UPNP getdevicelist on windows 2000 server
    ... and then you will see the memory usage shoot up. ... * a specially crafted request to upnp_getdevicelist ...
    (Vuln-Dev)
  • Re: Encrypt String or different approach
    ... > Don't use a GET (using a querystring), but rather a POST to the target ... >> those processes is to allow them to download files in their FTP Root ... >> then provides a link that would spawn a new window which would initiate ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Encrypt String or different approach
    ... > Don't use a GET (using a querystring), but rather a POST to the target ... >> those processes is to allow them to download files in their FTP Root ... >> then provides a link that would spawn a new window which would initiate ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: BUG? With A HTTPModule
    ... querystring is specified but encountered 404 error if request the url ... I tried visit some pages (which is in the root folder of the application) ... both with querystring and without any querystring but seems not encounter ...
    (microsoft.public.dotnet.framework.aspnet)