« Previous Next »

Thread: how to get post date in isapi extension? when data is large.

Last post 11-09-2009 4:34 AM by kylekou. 8 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (9 items)

Sort Posts:

  • 10-27-2009, 1:31 AM

    • kylekou
    • Not Ranked
    • Joined on 10-27-2009, 5:27 AM
    • Posts 5

    how to get post date in isapi extension? when data is large.

    HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB)

    in this method , how get post data?

    thanks in advance!

  • 10-27-2009, 1:32 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: how to get post date in isapi extension? when data is large.

    You can use either pECB->ReadClient(...) or pECB->ServerSupportFunction(..., HSE_REQ_ASYNC_READ_CLIENT, ...) - you can find further documentation on msdn.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 10-27-2009, 9:32 PM In reply to

    • kylekou
    • Not Ranked
    • Joined on 10-27-2009, 5:27 AM
    • Posts 5

    Re: how to get post date in isapi extension? when data is large.

     

    thans, i post my code here, there is something wrong with it, though i can get whole post data, but can't set post back to next request, the web site page can't show.

       ISAPI_REQUEST request(pECB);
       ISAPI_BUFFER buffEntity;
       ISAPI_STRING strData;
       CString strBuffer2;
       long nContentLength;
       
       if (request.GetServerVariable("CONTENT_LENGTH", &strData))
       {
        nContentLength = atol(strData.QueryStr());
        if (nContentLength > 0)
        {
         buffEntity.SetMaxAlloc(nContentLength);
         
         if (!request.ReadAllEntity(&buffEntity))
         {
          OutputDebugString("request body get fail, too big!");
          return process_original_url(pECB);
         }
        }
       } else {
        OutputDebugString("request body length get fail!");
        return process_original_url(pECB);
       }
       
       char *tmp = (char*)malloc(nContentLength);
       memset(tmp, 0, nContentLength);
       strcpy(tmp, (char*)buffEntity.QueryPtr());

       struffer2 = tmp;
       if(NULL != tmp)
         {
          delete tmp;
          tmp = NULL;
         } 
      
         return SetRequestPackage(pECB, buffEntity, request.IsCallReadClient());

    DWORD SetRequestPackage(EXTENSION_CONTROL_BLOCK *pecb, ISAPI_BUFFER buffEntity, bool flag)
    {
     HSE_EXEC_URL_INFO* pExecUrlInfo = new HSE_EXEC_URL_INFO;
     if(NULL == pExecUrlInfo)
     {
      return HSE_STATUS_ERROR;
     }
     ZeroMemory( pExecUrlInfo, sizeof( HSE_EXEC_URL_INFO ) );
     pExecUrlInfo->pszUrl   = NULL;  //URL
     pExecUrlInfo->pszMethod   = NULL;  //method
     pExecUrlInfo->pszChildHeaders = NULL;  //header
     pExecUrlInfo->pUserInfo   = NULL;  //user info
     pExecUrlInfo->pEntity   = NULL;  //body

     pExecUrlInfo->dwExecUrlFlags = HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR;

     EXTENSION_DATA* ped = new EXTENSION_DATA;
     ped->pHEUI = pExecUrlInfo;
     ped->pBody = NULL;

     if(flag)
     {
      DWORD dwSize = buffEntity.QueryDataSize();
      ped->pBody = (char*)buffEntity.QueryPtr();
      HSE_EXEC_URL_ENTITY_INFO* pEntityInfo = new HSE_EXEC_URL_ENTITY_INFO;
      pEntityInfo->lpbData = (void*)ped->pBody;
      pEntityInfo->cbAvailable = dwSize;
      pExecUrlInfo->pEntity = pEntityInfo;
     }
     
     if ( pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_IO_COMPLETION, HandleCompletion, NULL, (LPDWORD)ped) == FALSE) {
      WriteLog("ServerSupportFunction1");
      return SyncSendGenericServerError(pecb);
      }
     
     if ( pecb->ServerSupportFunction( pecb->ConnID, HSE_REQ_EXEC_URL, pExecUrlInfo, NULL, NULL) == FALSE) {
      WriteLog("ServerSupportFunction2");
      return SyncSendGenericServerError(pecb);
     }

     return HSE_STATUS_PENDING;
    }

    can anybody give me some advice?

  • 10-28-2009, 8:11 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: how to get post date in isapi extension? when data is large.

    Note that upto 48k of data (by default) is pre-read in pECB->lpbData/cbAvailable - also, if you are just reading the data to pass it along to ECEC_URL, you need not do that - just pass the pre-loaded data, the rest will be automatically passed along.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 10-28-2009, 10:07 PM In reply to

    • kylekou
    • Not Ranked
    • Joined on 10-27-2009, 5:27 AM
    • Posts 5

    Re: how to get post date in isapi extension? when data is large.

    i don't want modify data, do you mean this SetRequestPackage() no need ?

    just return the predata?  how return the data? i can't find a right way? please help me !

  • 10-29-2009, 8:03 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: how to get post date in isapi extension? when data is large.

    Just do

    pEntityInfo->lpbData = pECB->lpbData;
    pEntityInfo->cbAvailable = pECB->cbAvailable;

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 10-29-2009, 10:01 PM In reply to

    • kylekou
    • Not Ranked
    • Joined on 10-27-2009, 5:27 AM
    • Posts 5

    Re: how to get post date in isapi extension? when data is large.

    DWORD SetRequestPackage(EXTENSION_CONTROL_BLOCK *pecb, ISAPI_BUFFER buffEntity, bool flag)
    {
     HSE_EXEC_URL_INFO* pExecUrlInfo = new HSE_EXEC_URL_INFO;
     if(NULL == pExecUrlInfo)
     {
      return HSE_STATUS_ERROR;
     }
     ZeroMemory( pExecUrlInfo, sizeof( HSE_EXEC_URL_INFO ) );
     pExecUrlInfo->pszUrl   = NULL;  //URL
     pExecUrlInfo->pszMethod   = NULL;  //method
     pExecUrlInfo->pszChildHeaders = NULL;  //header
     pExecUrlInfo->pUserInfo   = NULL;  //user info
     pExecUrlInfo->pEntity   = NULL;  //body

     pExecUrlInfo->dwExecUrlFlags = HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR;

     if(flag)
     {
      HSE_EXEC_URL_ENTITY_INFO* pEntityInfo = new HSE_EXEC_URL_ENTITY_INFO;
      pEntityInfo->lpbData = pecb->lpbData;
      pEntityInfo->cbAvailable = pecb->cbAvailable;
      pExecUrlInfo->pEntity = pEntityInfo;
     }
     
     if ( pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_IO_COMPLETION, HandleCompletion, NULL, (LPDWORD)pExecUrlInfo) == FALSE) {
      WriteLog("ServerSupportFunction1");
      return SyncSendGenericServerError(pecb);
      }
     
     if ( pecb->ServerSupportFunction( pecb->ConnID, HSE_REQ_EXEC_URL, pExecUrlInfo, NULL, NULL) == FALSE) {
      WriteLog("ServerSupportFunction2");
      return SyncSendGenericServerError(pecb);
     }

     return HSE_STATUS_PENDING;
    }

     when i change like this , only 16k data be post, else loss,  if  pecb->cbAvailable change pecb->cbTotalBytes or not ?

  • 11-07-2009, 3:21 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: how to get post date in isapi extension? when data is large.

    The above should work - I am not sure what to suggest to troubleshoot further.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 11-09-2009, 4:34 AM In reply to

    • kylekou
    • Not Ranked
    • Joined on 10-27-2009, 5:27 AM
    • Posts 5

    Re: how to get post date in isapi extension? when data is large.

    appreciate for your help!

    i find the mistake , because i don't use dynamic malloc memory.

    ISAPI_BUFFER *buffEntity = new ISAPI_BUFFER; then , it work correctly.

Page 1 of 1 (9 items)
Microsoft Communities