procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); const WEBROOT = 'C:/www'; var RequestDocument:string; begin RequestDocument:=LowerCase(ARequestInfo.Document); if RequestDocument='/' then RequestDocument:='/index.html'; if FileExists(WEBROOT+RequestDocument) then begin AResponseInfo.ContentStream:=TFileStream.Create(WEBROOT+RequestDocument, fmOpenRead + fmShareDenyWrite); end else begin AResponseInfo.ResponseNo := 404; end; AResponseInfo.Server:='IIS/6.0'; AResponseInfo.CacheControl:='no-cache'; AResponseInfo.Pragma:='no-cache'; AResponseInfo.Date:=Now;
procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); const WEBROOT = 'C:/www'; var RequestDocument:string; begin RequestDocument:=LowerCase(ARequestInfo.Document); if RequestDocument='/' then RequestDocument:='/index.html'; if FileExists(WEBROOT+RequestDocument) then begin AResponseInfo.ContentStream:=TFileStream.Create(WEBROOT+RequestDocument, fmOpenRead + fmShareDenyWrite); end else begin AResponseInfo.ResponseNo := 404; end; AResponseInfo.Server:='IIS/6.0'; AResponseInfo.CacheControl:='no-cache'; AResponseInfo.Pragma:='no-cache'; AResponseInfo.Date:=Now;end; 这段代码的话,应付一般的html网站应该足够了...
procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
const
WEBROOT = 'C:/www';
var
RequestDocument:string;
begin
RequestDocument:=LowerCase(ARequestInfo.Document); if RequestDocument='/' then
RequestDocument:='/index.html'; if FileExists(WEBROOT+RequestDocument) then
begin
AResponseInfo.ContentStream:=TFileStream.Create(WEBROOT+RequestDocument, fmOpenRead + fmShareDenyWrite);
end
else
begin
AResponseInfo.ResponseNo := 404;
end; AResponseInfo.Server:='IIS/6.0';
AResponseInfo.CacheControl:='no-cache';
AResponseInfo.Pragma:='no-cache';
AResponseInfo.Date:=Now;
procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
const
WEBROOT = 'C:/www';
var
RequestDocument:string;
begin
RequestDocument:=LowerCase(ARequestInfo.Document); if RequestDocument='/' then
RequestDocument:='/index.html'; if FileExists(WEBROOT+RequestDocument) then
begin
AResponseInfo.ContentStream:=TFileStream.Create(WEBROOT+RequestDocument, fmOpenRead + fmShareDenyWrite);
end
else
begin
AResponseInfo.ResponseNo := 404;
end; AResponseInfo.Server:='IIS/6.0';
AResponseInfo.CacheControl:='no-cache';
AResponseInfo.Pragma:='no-cache';
AResponseInfo.Date:=Now;end;
这段代码的话,应付一般的html网站应该足够了...