To send a big file via winHttp Typically we do a loop like the one below (from delphi source code) :
while LRequest.FSourceStream.Position < LRequest.FSourceStream.Size do
begin
ToRead := LRequest.FSourceStream.Size - LRequest.FSourceStream.Position;
LRequest.FSourceStream.ReadBuffer(Buffer, ToRead);
// Write data to the server.
if not WinHttpWriteData(LRequest.FWRequest, Buffer[0], ToRead, @BytesWritten) then
raise ENetHTTPClientException.CreateResFmt(@SNetHttpClientSendError, [GetLastError, SysErrorMessage(GetLastError, GLib.Handle)]);
end;
Now the problem is that on the Server, if I don't read the content of the request (just the header) then it's will not stop the previous loop. Is their any way to stop the previous loop when the server don't request to read more byte ?