mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 19:29:26 +02:00
* Fix content sending
git-svn-id: trunk@38585 -
This commit is contained in:
parent
250e924ad3
commit
5a8a3ddc21
@ -1158,6 +1158,7 @@ Var
|
||||
FWriter : THTMLWriter;
|
||||
B : Boolean;
|
||||
M : TMemoryStream;
|
||||
|
||||
|
||||
begin
|
||||
FDocument := CreateDocument;
|
||||
@ -1168,20 +1169,23 @@ begin
|
||||
If Assigned(OnGetContent) then
|
||||
OnGetContent(Self,ARequest,FWriter,B);
|
||||
If Not B then
|
||||
begin
|
||||
Actions.HandleRequest(ARequest,FWriter,B);
|
||||
If Not B then
|
||||
Raise EHTMLError.Create(SErrRequestNotHandled);
|
||||
end
|
||||
else
|
||||
If Not B then
|
||||
Raise EHTMLError.Create(SErrRequestNotHandled);
|
||||
If (AResponse.ContentStream=Nil) then
|
||||
begin
|
||||
If (AResponse.ContentStream=Nil) then
|
||||
begin
|
||||
M:=TMemoryStream.Create;
|
||||
AResponse.ContentStream:=M;
|
||||
AResponse.FreeContentStream:=True;
|
||||
FDocument.SaveToStream(AResponse.ContentStream);
|
||||
end;
|
||||
M:=TMemoryStream.Create;
|
||||
AResponse.ContentStream:=M;
|
||||
AResponse.FreeContentStream:=True;
|
||||
end;
|
||||
if not AResponse.ContentSent then
|
||||
begin
|
||||
FDocument.SaveToStream(AResponse.ContentStream);
|
||||
AResponse.ContentStream.Position:=0;
|
||||
if (AResponse.ContentType='') then
|
||||
AResponse.ContentType:='text/html';
|
||||
AResponse.ContentLength:=AResponse.ContentStream.Size;
|
||||
AResponse.SendContent;
|
||||
end;
|
||||
Finally
|
||||
FreeAndNil(FWriter);
|
||||
|
Loading…
Reference in New Issue
Block a user