library helloworld; {$ifdef fpc} {$mode objfpc}{$H+} {$endif} uses SysUtils, Classes, ISAPI; function GetExtensionVersion(var pVer: THSE_VERSION_INFO): BOOL; stdcall; begin pVer.dwExtensionVersion := LONG((WORD(HSE_VERSION_MINOR)) or ((DWORD(WORD(HSE_VERSION_MAJOR))) shl 16)); pVer.lpszExtensionDesc := 'Simple ISAPI DLL' + #0; result := true; end; function TerminateExtension(dwFlags: DWORD): BOOL; stdcall; begin // This is so that the Apache web server will know what "True" really is Integer(result) := 1; end; function HttpExtensionProc(var pECB: TEXTENSION_CONTROL_BLOCK): DWORD; stdcall; var HTTPStatusCode: integer; dwLen: Cardinal; sResponse: string; begin HTTPStatusCode := 200; result := HSE_STATUS_ERROR; sResponse := ''#13#10 + ''#13#10 + ''#13#10 + ' '#13#10 + ' '#13#10 + ' '#13#10 + ' Hallo Welt'#13#10 + ' '#13#10 + ' '#13#10 + '

Hallo Welt!

'#13#10 + ' '#13#10 + ''; sResponse := 'HTTP/1.1 '+ IntToStr(HTTPStatusCode) + #13#10 + 'Content-Type: text/html' + #13#10 + 'Content-Length: ' + Format('%d', [Length(sResponse)]) + #13#10 + 'Content:'#13#10#13#10 + sResponse; pECB.dwHTTPStatusCode := HTTPStatusCode; dwLen := Length(sResponse); pECB.WriteClient(pECB.ConnID, Pointer(sResponse), dwLen, 0); Result := HSE_STATUS_SUCCESS; end; exports GetExtensionVersion, HttpExtensionProc, TerminateExtension; end.