You are not logged in.
if Context.ContentFromFile(fn, CompressGz) then
OutContent := Context.Content ==> fRespStatus := HTTP_SUCCESS outContent no need
else
begin
FormatString('Impossible to find %', [fn], fErrorMessage);
fRespStatus := HTTP_NOTFOUND;
end;
follow :
Context.Content := OutContent; ==> if not ((OutContent <> '') and (OutContentType = STATICFILE_CONTENT_TYPE)) then Context.Content := OutContent;
Context.ContentType := OutContentType;
then can right download file
Last edited by gunix (2023-07-14 01:09:40)
Offline
I See, OnRequest call back shoud return HTTP_SUCCESS
OnRequest(Ctxt: THttpServerRequestAbstract): cardinal;
begin
Result:=HTTP_FOUND; //default return value
Ctxt.OutContentType:=TEXT_CONTENT_TYPE;
if StartWith(Ctxt.Url, uppercase('/upgradefile/')) then begin
Ctxt.OutContentType:=STATICFILE_CONTENT_TYPE;
ctxt.OutContent:=StringToUtf8('xxxxxxx');
ctxt.RespStatus:= HTTP_SUCCESS; ==> Result:=HTTP_SUCCESS;
end
end;
Last edited by gunix (2023-07-14 01:17:15)
Offline
Offline
I am not sure I understand what you meant, sorry.
Do you mean that your callback should return result = 200 so that it works as expected?
So is it solved?
Yes
Offline