W
Wilbur
Unregistered / Unconfirmed
GUEST, unregistred user!
我想在 ISAPI Filter 中得到用户 POST 的信息(如用户在 form 中填写的信息), 我使用下面的代码(注意 GetServerVariable)
DWORD WINAPI __stdcall HttpFilterProc(HTTP_FILTER_CONTEXT* pfc,
DWORD NotificationType,
VOID* pvData)
{
switch(NotificationType) {
case SF_NOTIFY_READ_RAW_DATA:
DebugOut("/nOnReadRawData/n");
OnReadRawData(pfc, pvData);
break;
default:
break;
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
void OnReadRawData(HTTP_FILTER_CONTEXT* pfc, VOID* pvData)
{
PHTTP_FILTER_RAW_DATA pRawData = (PHTTP_FILTER_RAW_DATA)pvData;
char* pchIn = (char* )pRawData->pvInData;
int size = pRawData->cbInData;
char pVariable[1024];
unsigned long dwSize = 1023;
pfc->GetServerVariable(pfc, "REQUEST_METHOD", pVariable, &dwSize); // ???
if(dwSize > 1) {
DebugOut("REQUEST_METHOD: %s, size: %d/n", pVariable, dwSize);
if(strncmp(pVariable, "POST", dwSize) == 0) {
DebugOut("POST/n");
}
return;
}
else {
return;
}
}
但是, 调试中发现 dwSize = 1, pVariable = NULL.
请大侠不吝赐教.
DWORD WINAPI __stdcall HttpFilterProc(HTTP_FILTER_CONTEXT* pfc,
DWORD NotificationType,
VOID* pvData)
{
switch(NotificationType) {
case SF_NOTIFY_READ_RAW_DATA:
DebugOut("/nOnReadRawData/n");
OnReadRawData(pfc, pvData);
break;
default:
break;
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
void OnReadRawData(HTTP_FILTER_CONTEXT* pfc, VOID* pvData)
{
PHTTP_FILTER_RAW_DATA pRawData = (PHTTP_FILTER_RAW_DATA)pvData;
char* pchIn = (char* )pRawData->pvInData;
int size = pRawData->cbInData;
char pVariable[1024];
unsigned long dwSize = 1023;
pfc->GetServerVariable(pfc, "REQUEST_METHOD", pVariable, &dwSize); // ???
if(dwSize > 1) {
DebugOut("REQUEST_METHOD: %s, size: %d/n", pVariable, dwSize);
if(strncmp(pVariable, "POST", dwSize) == 0) {
DebugOut("POST/n");
}
return;
}
else {
return;
}
}
但是, 调试中发现 dwSize = 1, pVariable = NULL.
请大侠不吝赐教.