Hi,

when using the HTTP server component with some custom TStream descendant
together with partial GET requests I noticed that the Read method of
THttpRangeStream incorrectly handles the situation where Read returns less
bytes that requested. It switches to the next stream member in the list
without checking if end-of-stream has been reached.

The included patch fixes this bug. It would be great if you could consider
including the patch in the upstream version of ICS.

Regards,
Tobias


(begin patch)

Index: OverbyteIcsHttpSrv.pas
===================================================================
--- OverbyteIcsHttpSrv.pas      (revision 1075)
+++ OverbyteIcsHttpSrv.pas      (working copy)
@@ -6236,9 +6236,12 @@
                 ActSize   := min(Count - DataRead, Rec.Size - (ActOffset));
                 Rec.Stream.Position := ActOffset + Rec.StartPos;
                 SizeRead := Rec.Stream.Read(Pointer(DWORD(@Buffer) + 
DWORD(DataRead))^, ActSize);
-                Inc(Index);
                 Inc(DataRead, SizeRead);
                 Inc(FPosition, SizeRead);
+                if (Rec.Offset + Rec.Size) > FPosition then
+                    Break
+                else
+                    Inc(Index);
             end;
             Result := DataRead;
             Exit;

(end patch)

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to