Re: Alter querystring through APP
- From: "Max K." <maxkl@xxxxxxxxxxxxx>
- Date: Fri, 26 Oct 2007 11:08:08 -0700
On Oct 26, 11:55 am, "Igor Tandetnik" <itandet...@xxxxxxxx> wrote:
Max K. <ma...@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.
Correct. This is pseudocode. Sorry I did not point it out.
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?
I checked all of that before. My App calls target
ReportProgress(BINDSTATUS_REDIRECTING), ReportData(), ReportResult()
only once. This is just pseudocode.
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?
In my case I have an empty form, with method = POST and action is
blank. It means that it has to send an empty POST request to the same
URL + querystring that was on the address bar. Correct?
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?
The first was initiated by typing URL in Browser address bar. The
second request was hitting submit on the form returned by the first
request.
--
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- Hide quoted text -
- Show quoted text -
My general question: is it possible for the APP to change URL after
request was initiated by browser? In my test described above I was
only able to change the URL for 2 consecutive requests and then on the
3-rd request the browser stopped working.
.
- Follow-Ups:
- Re: Alter querystring through APP
- From: Igor Tandetnik
- Re: Alter querystring through APP
- References:
- Alter querystring through APP
- From: Max K.
- Re: Alter querystring through APP
- From: Igor Tandetnik
- Alter querystring through APP
- Prev by Date: Re: Alter querystring through APP
- Next by Date: Re: Alter querystring through APP
- Previous by thread: Re: Alter querystring through APP
- Next by thread: Re: Alter querystring through APP
- Index(es):
Relevant Pages
|
Loading