DWORD WINAPI WorkerFunction(IN LPVOID vECB) { char szHeader[] = "Content-type: text/html\r\n\r\n"; char szContent[] = "<html> <form method=get action=WorkerThread.dll><h1>Worker Thread Sample</h1><hr>" "<input type=submit value=\"Send Request\"> </form></html>"; /* Initialize local ECB pointer to void pointer passed to thread */ EXTENSION_CONTROL_BLOCK *pECB = vECB; DWORD dwSize = strlen(szContent); /* Send outgoing header */ SendHttpHeaders(pECB, "200 OK", szHeader, FALSE); /* Simulate extended processing for 5 seconds */ Sleep(5000); /* Send content */ pECB->WriteClient(pECB->ConnID, szContent, &dwSize, 0); /* Inform server that the request has been satisfied, and the connection may now be dropped */ pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_DONE_WITH_SESSION, NULL, NULL, NULL); /* update global thread count */ InterlockedDecrement(&g_dwThreadCount); return 0; }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % C G I F i f o % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Method CGIFifo is the default output stream handler for CGI usage. It is % called by the stream subsystem whenever a buffer of data needs to be sent % to the output.It receives a pointer to the image as well as the buffer % of data and its length. % % The format of the HttpUnescape method is: % % int CGIFifo(const Image *image,const void *data,const size_t length) % % A description of each parameter follows: % % o image: A pointer to the image being sent to the output stream. % % o data: A pointer to the buffer of data to be sent. % % o length: The length of the buffer of data to be sent. % */ int CGIFifo(const Image *image,const void *data,const size_t length) { EXTENSION_CONTROL_BLOCK *pECB; size_t tlen=length; pECB = (EXTENSION_CONTROL_BLOCK *)image->client_data; pECB->WriteClient( pECB->ConnID, (char *)data, &tlen, 0); return(tlen); }