2
0
Эх сурвалжийг харах

* Make sure size is set after return

Michaël Van Canneyt 4 жил өмнө
parent
commit
e6f40c196a

+ 3 - 2
packages/fcl-web/src/base/fpwebfile.pp

@@ -262,10 +262,11 @@ begin
     aResponse.CacheControl:=Format('max-age=%d',[CacheControlMaxAge]);
     aResponse.CacheControl:=Format('max-age=%d',[CacheControlMaxAge]);
   F:=TFileStream.Create(AFileName,fmOpenRead or fmShareDenyWrite);
   F:=TFileStream.Create(AFileName,fmOpenRead or fmShareDenyWrite);
   try
   try
-    AResponse.ContentLength:=F.Size;
-    AResponse.ContentStream:=F;
+    AResponse.ContentStream:=F; // Sets size
     AResponse.SendContent;
     AResponse.SendContent;
     AResponse.ContentStream:=Nil;
     AResponse.ContentStream:=Nil;
+    // We set it again so an after request interceptor can see it
+    AResponse.ContentLength:=F.Size;
   finally
   finally
     F.Free;
     F.Free;
   end;
   end;