Note that there are some explanatory texts on larger screens.

plurals
  1. POResume HTTP Post/upload with Indy
    primarykey
    data
    text
    <p>I'm trying to resume an upload using indy (HTTP Post), the code looks like this (using Delphi 2010, Indy 10.4736):</p> <pre><code> IdHttp.Head('http://localhost/_tests/resume/large-file.bin'); ByteRange := IdHttp.Response.ContentLength + 1; // Attach the file to post/upload Stream := TIdMultipartFormDataStream.Create; with Stream.AddFile('upload_file', 'D:\large-file.bin', 'application/octet-stream') do begin HeaderCharset := 'utf-8'; HeaderEncoding := '8'; end; // with with IdHTTP do begin IOHandler.LargeStream := True; with Request do begin ContentRangeStart := ByteRange; ContentRangeEnd := (Stream.Size - ByteRange); ContentLength := ContentRangeEnd; ContentRangeInstanceLength := ContentLength; end; // with Post('http://localhost/_tests/resume/t1.php', Stream); end; // with </code></pre> <p>but upload resume doesn't work :(</p> <p>I looked into Indy's code, it seems that this function in <strong>IdIOHandler.pas</strong></p> <blockquote> <p>TIdIOHandler.Write()</p> </blockquote> <p>always deal with complete streams/files (since the parameter ASize: TIdStreamSize seems to be always 0, which according to the code means sending the full file/stream).</p> <p>This prevents indy from resuming the upload.</p> <p>My question is: is it possible to avoid sending the full file?</p> <p>Setting content range didn't change anything. I also tweaked indy's code (modified 3 lines) to make indy obey to the content range / stream position, but it's buggy and indy always end up hanging in <strong>IdStackWindows.pas</strong> because of an infinite timeout here:</p> <blockquote> <p>TIdSocketListWindows.FDSelect()</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload