josmond
Jul 29th, 2002, 04:14 AM
Hi,
I wonder if anybody can help. I'm writing an isapi filter to handle asp querystring. As a VB programmer all this c++ coding
is getting me out of my depth. What I want it to do is take a URL in and split it into a querystring. Basic explaination is
1) Check for .asp
2) Check for szSep (e.g idx)
3) Copy URL upto szSep
4) Extract Middle bit (upto .asp)
5) Concatenate StartBit & ".asp"
6) Add on "?id=" & MiddleBit
I've almost got it working (see below) but the rem'd out bits is where I'm stuck (it's part C++ and part VB) - but I'm worried about
leakage if I don't do it properly
Please Help......
My code goes something like....
char aa[1000];
DWORD CURLRewriteFilterFilter::HttpFilterProc(PHTTP_FILTER_CONTEXT pFC, DWORD dwNotificationType, LPVOID pvNotification)
{
HTTP_FILTER_PREPROC_HEADERS *p=(HTTP_FILTER_PREPROC_HEADERS *)pvNotification;
unsigned long d = sizeof(aa);;
char *szSep = "idx";
p->GetHeader(pFC, "url", aa, &d);
char *FoundInst;
FoundInst = strstr(strlwr(aa), ".asp");
if (FoundInst!= 0)
{ FoundInst = strstr(strlwr(aa), strlwr(szSep));
if (FoundInst!= 0)
{
//szNewURL = Left(szURL, iStartPos - 1)
//iStartPos = iStartPos + 3
//szID = Mid(szURL, iStartPos, Len(szURL) - (iStartPos + 3))
//If Len(szID) > 0 Then szNewURL = szNewURL & ".asp?id=" & szID
p->SetHeader(pFC,"url", szNewURL);
}
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
:(
I wonder if anybody can help. I'm writing an isapi filter to handle asp querystring. As a VB programmer all this c++ coding
is getting me out of my depth. What I want it to do is take a URL in and split it into a querystring. Basic explaination is
1) Check for .asp
2) Check for szSep (e.g idx)
3) Copy URL upto szSep
4) Extract Middle bit (upto .asp)
5) Concatenate StartBit & ".asp"
6) Add on "?id=" & MiddleBit
I've almost got it working (see below) but the rem'd out bits is where I'm stuck (it's part C++ and part VB) - but I'm worried about
leakage if I don't do it properly
Please Help......
My code goes something like....
char aa[1000];
DWORD CURLRewriteFilterFilter::HttpFilterProc(PHTTP_FILTER_CONTEXT pFC, DWORD dwNotificationType, LPVOID pvNotification)
{
HTTP_FILTER_PREPROC_HEADERS *p=(HTTP_FILTER_PREPROC_HEADERS *)pvNotification;
unsigned long d = sizeof(aa);;
char *szSep = "idx";
p->GetHeader(pFC, "url", aa, &d);
char *FoundInst;
FoundInst = strstr(strlwr(aa), ".asp");
if (FoundInst!= 0)
{ FoundInst = strstr(strlwr(aa), strlwr(szSep));
if (FoundInst!= 0)
{
//szNewURL = Left(szURL, iStartPos - 1)
//iStartPos = iStartPos + 3
//szID = Mid(szURL, iStartPos, Len(szURL) - (iStartPos + 3))
//If Len(szID) > 0 Then szNewURL = szNewURL & ".asp?id=" & szID
p->SetHeader(pFC,"url", szNewURL);
}
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
:(