unit minimain; interface {$mode delphi}{$H+} uses SysUtils, Classes, httpd, apr; procedure RegisterHooks(p: Papr_pool_t); cdecl; implementation function DefaultHandler(r: Prequest_rec): Integer; cdecl; var RequestedHandler: string; begin RequestedHandler := r^.handler; { We decline to handle a request if hello-handler is not the value of r->handler } if not SameText(RequestedHandler, 'testapache-handler') then begin Result := DECLINED; Exit; end; { The following line just prints a message to the errorlog } ap_log_error('me',1, APLOG_NOERRNO or APLOG_NOTICE, 0, r^.server, 'mod_hello: %s', ['Before content is output']); { We set the content type before doing anything else } ap_set_content_type(r, 'text/html'); { If the request is for a header only, and not a request for the whole content, then return OK now. We don't have to do anything else. } if (r^.header_only <> 0) then begin Result := OK; Exit; end; { Now we just print the contents of the document using the ap_rputs and ap_rprintf functions. More information about the use of these can be found in http_protocol.h } ap_rputs('' + LineEnding, r); ap_rputs('
' + LineEnding, r); ap_rputs('