TIdHTTP and Chunked Transfers

Giganews Newsgroups
Subject: TIdHTTP and Chunked Transfers
Posted by:  Steve Caupp (scau…@mfm.com)
Date: Mon, 18 Aug 2003

I'm using Indy 9.0.3 beta.

A server I work with returns "normal" responses for most GETs and
everything's hunky-dory.  One particular URL results in a "chunked"
response.  When this happens, the OnWork event fires over and over
with an AWorkCount of 89.  Everything I can find indicates that Indy's
TIdHTTP has handled chunked responses automatically since 2001.

This section of TIdCustomHTTP.ReadResult does run (i.e. the server
does "chunked" in its Transfer-Encoding header):

if AnsiPos('chunked',
          AResponse.RawHeaders.Values['Transfer-Encoding']) > 0 then
          {do not localize}
  begin // Chunked
    DoStatus(hsStatusText, [RSHTTPChunkStarted]);
    Size := ChunkSize;
    while Size > 0 do
    begin
      ReadStream(AResponse.ContentStream, Size);
      ReadLn; // blank line
      Size := ChunkSize;
    end;
    ReadLn; // blank line
  end

Is there anything I need to set to enable chunked transfers, or
something I might have set that I shouldn't have?

Replies