Check for INDY in new SSE controller

This commit is contained in:
Daniele Teti 2023-01-06 15:07:44 +01:00
parent 6fbfa6190b
commit 4f9243826a

View File

@ -98,10 +98,15 @@ const
EOL = #13#10;
begin
inherited;
lLastEventID := Context.Request.Headers[TMVCConstants.SSE_LAST_EVENT_ID].Trim;
{TODO -oDanieleT -cSSE : We've to find a workaround for Apache modules and ISAPIs}
if not (Context.Response.RawWebResponse is TIdHTTPAppResponse) then
begin
raise EMVCException.Create(HTTP_STATUS.InternalServerError, ClassName + ' can only be used with INDY based application server');
end;
lRawContext := TIdHTTPAppResponseAccess(Context.Response.RawWebResponse).FThread;
lLastEventID := Context.Request.Headers[TMVCConstants.SSE_LAST_EVENT_ID].Trim;
lIOHandler := lRawContext.Connection.IOHandler;
lIOHandler.WriteBufferOpen();
lIOHandler.WriteLn('HTTP/1.1 200 OK');
@ -144,6 +149,7 @@ begin
end;
Sleep(200); //arbitrary... some better approches?
end;
lRawContext.Connection.Disconnect;
end;
end.