View Issue Details

IDProjectCategoryView StatusLast Update
0032656FPCFCLpublic2017-12-29 10:29
ReporterTudor HulbanAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platform64 bitOSWindowsOS Version7
Product Version3.0.2Product Build3.0.4 
Target Version3.2.0Fixed in Version3.1.1 
Summary0032656: Chunk too big reported for HTTP GET. RFC2616 does not limit chunk
Descriptionhi All,
while doing a GET with TFPHttpClient I am getting a EHTTPClient.Create(SErrChunkTooBig) for a 10 M reguest (for a bandwidth check).
as per RFC2616 there is no chunk size limit.
please advise on the limitation or could it be reviewed and for persons interested the initial stream size could be used for triggering the error?

from fphttpclient.pp around line 1057, Lazarus 1.8RC5 with FPC 3.0.4:
    if ChunkSize>1000000 then Raise EHTTPClient.Create(SErrChunkTooBig);

see: http://forum.lazarus.freepascal.org/index.php/topic,38853.msg265195/topicseen.html#new
Steps To Reproduceprocedure TGETSpeed.CheckSpeed(AURL: string; ABytes: longword);
var
  t1, t2: TDateTime;
  url: string;
  params: string;
  HTTPRequest: TFPHttpClient;

begin
  try
    params := 's=' + EncodeURLElement(IntToStr(ABytes));
    url := AURL + '?' + params;

    try
      HTTPRequest := TFPHttpClient.Create(nil);
      t1 := now();
      HTTPRequest.Get(url);
      t2 := now();

      TriggerError(IntToStr(MilliSecondsBetween(t2, t1)));
    except
      on E: Exception do
      begin
        HTTPRequest.Free;
        TriggerError('Error:' + E.Message);
      end;
    end;
  finally
    FreeAndNil(HTTPRequest);
  end;
end;
Additional Informationwith Synpase it works:

procedure TGETSpeed.CheckSpeedSynapse(AURL: string; ABytes: longword);
var
  t1, t2: TDateTime;
  url: string;
  params: string;
  HTTPRequest: THTTPSend;

begin
  try
    params := 's=' + EncodeURLElement(IntToStr(ABytes));
    url := AURL + '?' + params;

    try
      HTTPRequest := THTTPSend.Create;
      t1 := now();
      HTTPRequest.HTTPMethod('GET',url);
      t2 := now();

      TriggerError(IntToStr(MilliSecondsBetween(t2, t1)));
    except
      on E: Exception do
      begin
        HTTPRequest.Free;
        TriggerError('Error:' + E.Message);
      end;
    end;
  finally
    FreeAndNil(HTTPRequest);
  end;
end;
TagsNo tags attached.
Fixed in Revision37849
FPCOldBugId
FPCTarget
Attached Files

Activities

Michael Van Canneyt

2017-12-29 10:29

administrator   ~0105091

Fixed, I made MaxChunkSize a property, it can be set to any nonzero value to enable the check, and zero will disable the check. I also added a check for an overflow.

Issue History

Date Modified Username Field Change
2017-11-07 12:24 Tudor Hulban New Issue
2017-11-07 15:32 Michael Van Canneyt Assigned To => Michael Van Canneyt
2017-11-07 15:32 Michael Van Canneyt Status new => assigned
2017-12-29 10:29 Michael Van Canneyt Fixed in Revision => 37849
2017-12-29 10:29 Michael Van Canneyt Note Added: 0105091
2017-12-29 10:29 Michael Van Canneyt Status assigned => resolved
2017-12-29 10:29 Michael Van Canneyt Fixed in Version => 3.1.1
2017-12-29 10:29 Michael Van Canneyt Resolution open => fixed
2017-12-29 10:29 Michael Van Canneyt Target Version => 3.2.0