1,593
社区成员
发帖
与我相关
我的任务
分享
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;
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;