|
|
|
date: Fri, 7 Sep 2007 12:31:18 +0100,
group: microsoft.public.platformsdk.internet.server.isapi-dev
back
first isapi filter
Hello, I followed the instructions on the link below to create an isapi
filter.
http://www.codeproject.com/isapi/isapiredirector.asp
I changed the code so that a default gif is served for all gif requests.
/==========================================================
DWORD CGetgifFilter::OnPreprocHeaders(CHttpFilterContext* pCtxt,
PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
{
// TODO: React to this notification accordingly
char buffer[256];
DWORD buffSize = sizeof(buffer);
BOOL bHeader = pHeaderInfo->GetHeader(pCtxt->m_pFC, "url", buffer,
&buffSize);
CString urlString(buffer);
urlString.MakeLower(); // for this exercise
if (urlString.Find(".gif") != -1) //we want to redirect this file
{
urlString.Replace(urlString,"/getgif.gif");
char *newUrlString= urlString.GetBuffer(urlString.GetLength());
pHeaderInfo->SetHeader(pCtxt->m_pFC, "url", newUrlString);
return SF_STATUS_REQ_HANDLED_NOTIFICATION;
}
// return the appropriate status code
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
==========================================================/
Do I need to register this? It fails when I try to with regsvr32, saying
"DllRegisterServer entry point was not found."
I added the isapi in iis, but it's not working.
Thanks Soc.
date: Fri, 7 Sep 2007 12:31:18 +0100
author: SOC
Re: first isapi filter
Moving this dll to C:\WINDOWS\system32\inetsrv from C:\WINDOWS\system32
appears to have solved this problem.
Thanks Soc.
"SOC" wrote in message
news:%23HlzhKU8HHA.464@TK2MSFTNGP02.phx.gbl...
> Hello, I followed the instructions on the link below to create an isapi
> filter.
> http://www.codeproject.com/isapi/isapiredirector.asp
>
> I changed the code so that a default gif is served for all gif requests.
> /==========================================================
> DWORD CGetgifFilter::OnPreprocHeaders(CHttpFilterContext* pCtxt,
> PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
> {
> // TODO: React to this notification accordingly
> char buffer[256];
> DWORD buffSize = sizeof(buffer);
> BOOL bHeader = pHeaderInfo->GetHeader(pCtxt->m_pFC, "url", buffer,
> &buffSize);
> CString urlString(buffer);
> urlString.MakeLower(); // for this exercise
> if (urlString.Find(".gif") != -1) //we want to redirect this file
> {
> urlString.Replace(urlString,"/getgif.gif");
> char *newUrlString= urlString.GetBuffer(urlString.GetLength());
> pHeaderInfo->SetHeader(pCtxt->m_pFC, "url", newUrlString);
> return SF_STATUS_REQ_HANDLED_NOTIFICATION;
> }
> // return the appropriate status code
> return SF_STATUS_REQ_NEXT_NOTIFICATION;
> }
> ==========================================================/
>
> Do I need to register this? It fails when I try to with regsvr32, saying
> "DllRegisterServer entry point was not found."
>
> I added the isapi in iis, but it's not working.
> Thanks Soc.
>
>
>
>
>
date: Fri, 7 Sep 2007 12:42:12 +0100
author: SOC
Re: first isapi filter
Hello,
The log files do not show the initial request, but the default gif instead.
Can this be changed?
Thanks Soc.
"SOC" wrote in message
news:eA5RoQU8HHA.2004@TK2MSFTNGP06.phx.gbl...
> Moving this dll to C:\WINDOWS\system32\inetsrv from C:\WINDOWS\system32
> appears to have solved this problem.
>
> Thanks Soc.
>
>
> "SOC" wrote in message
> news:%23HlzhKU8HHA.464@TK2MSFTNGP02.phx.gbl...
>> Hello, I followed the instructions on the link below to create an isapi
>> filter.
>> http://www.codeproject.com/isapi/isapiredirector.asp
>>
>> I changed the code so that a default gif is served for all gif requests.
>> /==========================================================
>> DWORD CGetgifFilter::OnPreprocHeaders(CHttpFilterContext* pCtxt,
>> PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
>> {
>> // TODO: React to this notification accordingly
>> char buffer[256];
>> DWORD buffSize = sizeof(buffer);
>> BOOL bHeader = pHeaderInfo->GetHeader(pCtxt->m_pFC, "url", buffer,
>> &buffSize);
>> CString urlString(buffer);
>> urlString.MakeLower(); // for this exercise
>> if (urlString.Find(".gif") != -1) //we want to redirect this file
>> {
>> urlString.Replace(urlString,"/getgif.gif");
>> char *newUrlString= urlString.GetBuffer(urlString.GetLength());
>> pHeaderInfo->SetHeader(pCtxt->m_pFC, "url", newUrlString);
>> return SF_STATUS_REQ_HANDLED_NOTIFICATION;
>> }
>> // return the appropriate status code
>> return SF_STATUS_REQ_NEXT_NOTIFICATION;
>> }
>> ==========================================================/
>>
>> Do I need to register this? It fails when I try to with regsvr32, saying
>> "DllRegisterServer entry point was not found."
>>
>> I added the isapi in iis, but it's not working.
>> Thanks Soc.
>>
>>
>>
>>
>>
>
>
date: Fri, 7 Sep 2007 14:31:41 +0100
author: SOC
Re: first isapi filter
You subscribe to the SF_NOTIFY_LOG event to control what gets logged.
You hardly want to use: urlString="/getgif.gif?"+urlString; - there
are better ways to preserve that information by using pFilterContext
off of the HTTP_FILTER_CONTEXT object.
FYI: that sample code you found is not very illustrative nor secure.
It's pretty bad, actually.
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
On Sep 7, 6:31 am, "SOC" wrote:
> Hello,
> The log files do not show the initial request, but the default gif instead.
> Can this be changed?
> Thanks Soc."SOC" wrote in message
>
> news:eA5RoQU8HHA.2004@TK2MSFTNGP06.phx.gbl...
>
>
>
> > Moving this dll to C:\WINDOWS\system32\inetsrv from C:\WINDOWS\system32
> > appears to have solved this problem.
>
> > Thanks Soc.
>
> > "SOC" wrote in message
> >news:%23HlzhKU8HHA.464@TK2MSFTNGP02.phx.gbl...
> >> Hello, I followed the instructions on the link below to create an isapi
> >> filter.
> >>http://www.codeproject.com/isapi/isapiredirector.asp
>
> >> I changed the code so that a default gif is served for all gif requests.
> >> /==========================================================
> >> DWORD CGetgifFilter::OnPreprocHeaders(CHttpFilterContext* pCtxt,
> >> PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
> >> {
> >> // TODO: React to this notification accordingly
> >> char buffer[256];
> >> DWORD buffSize = sizeof(buffer);
> >> BOOL bHeader = pHeaderInfo->GetHeader(pCtxt->m_pFC, "url", buffer,
> >> &buffSize);
> >> CString urlString(buffer);
> >> urlString.MakeLower(); // for this exercise
> >> if (urlString.Find(".gif") != -1) //we want to redirect this file
> >> {
> >> urlString.Replace(urlString,"/getgif.gif");
> >> char *newUrlString= urlString.GetBuffer(urlString.GetLength());
> >> pHeaderInfo->SetHeader(pCtxt->m_pFC, "url", newUrlString);
> >> return SF_STATUS_REQ_HANDLED_NOTIFICATION;
> >> }
> >> // return the appropriate status code
> >> return SF_STATUS_REQ_NEXT_NOTIFICATION;
> >> }
> >> ==========================================================/
>
> >> Do I need to register this? It fails when I try to with regsvr32, saying
> >> "DllRegisterServer entry point was not found."
>
> >> I added the isapi in iis, but it's not working.
> >> Thanks Soc.- Hide quoted text -
>
> - Show quoted text -
date: Sat, 08 Sep 2007 06:50:49 -0000
author: David Wang
Re: first isapi filter
Thanks David.
I'm not really a programmer so I was just pleased to get it working.
However it's worrying that you say it's not secure.
Soc
"David Wang" wrote in message
news:1189234249.924372.278110@r29g2000hsg.googlegroups.com...
> You subscribe to the SF_NOTIFY_LOG event to control what gets logged.
> You hardly want to use: urlString="/getgif.gif?"+urlString; - there
> are better ways to preserve that information by using pFilterContext
> off of the HTTP_FILTER_CONTEXT object.
>
> FYI: that sample code you found is not very illustrative nor secure.
> It's pretty bad, actually.
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //
>
>
>
> On Sep 7, 6:31 am, "SOC" wrote:
>> Hello,
>> The log files do not show the initial request, but the default gif
>> instead.
>> Can this be changed?
>> Thanks Soc."SOC" wrote in message
>>
>> news:eA5RoQU8HHA.2004@TK2MSFTNGP06.phx.gbl...
>>
>>
>>
>> > Moving this dll to C:\WINDOWS\system32\inetsrv from C:\WINDOWS\system32
>> > appears to have solved this problem.
>>
>> > Thanks Soc.
>>
>> > "SOC" wrote in message
>> >news:%23HlzhKU8HHA.464@TK2MSFTNGP02.phx.gbl...
>> >> Hello, I followed the instructions on the link below to create an
>> >> isapi
>> >> filter.
>> >>http://www.codeproject.com/isapi/isapiredirector.asp
>>
>> >> I changed the code so that a default gif is served for all gif
>> >> requests.
>> >> /==========================================================
>> >> DWORD CGetgifFilter::OnPreprocHeaders(CHttpFilterContext* pCtxt,
>> >> PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
>> >> {
>> >> // TODO: React to this notification accordingly
>> >> char buffer[256];
>> >> DWORD buffSize = sizeof(buffer);
>> >> BOOL bHeader = pHeaderInfo->GetHeader(pCtxt->m_pFC, "url", buffer,
>> >> &buffSize);
>> >> CString urlString(buffer);
>> >> urlString.MakeLower(); // for this exercise
>> >> if (urlString.Find(".gif") != -1) //we want to redirect this file
>> >> {
>> >> urlString.Replace(urlString,"/getgif.gif");
>> >> char *newUrlString= urlString.GetBuffer(urlString.GetLength());
>> >> pHeaderInfo->SetHeader(pCtxt->m_pFC, "url", newUrlString);
>> >> return SF_STATUS_REQ_HANDLED_NOTIFICATION;
>> >> }
>> >> // return the appropriate status code
>> >> return SF_STATUS_REQ_NEXT_NOTIFICATION;
>> >> }
>> >> ==========================================================/
>>
>> >> Do I need to register this? It fails when I try to with regsvr32,
>> >> saying
>> >> "DllRegisterServer entry point was not found."
>>
>> >> I added the isapi in iis, but it's not working.
>> >> Thanks Soc.- Hide quoted text -
>>
>> - Show quoted text -
>
>
date: Tue, 18 Sep 2007 09:34:05 +0100
author: SOC
|
|