Программирование в IIS




Пример 5.10


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Name: SendResponse

In: pECB - pointer to the extension control block

sValue - string reference to the value to be

written to the HTTP response

Out: nothing

Purpose:

writes the intended value to the HTTP response

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

void SendResponse(EXTENSION_CONTROL_BLOCK *pECB, string &sValue)

{

TCHAR szTempBuffer[BUFFER_LENGTH];

DWORD dwBufferSize = BUFFER_LENGTH;

// set content-type header

strcpy(szTempBuffer, BASIC_HEADER);

DWORD dwHeaderSize = strlen(szTempBuffer);

pECB->ServerSupportFunction(pECB->ConnID,

HSE_REQ_SEND_RESPONSE_HEADER,

NULL,

&dwHeaderSize,

(LPDWORD) szTempBuffer);

//write value to http response

DWORD dwLength=sValue.length();

pECB->WriteClient( pECB->ConnID,

(PVOID)sValue.c_str(),

&dwLength,

HSE_IO_SYNC);

}




Содержание  Назад  Вперед