Forum > Networking and Web Programming
TFPHttpClient - chunk size too big (RFC 2616)
(1/1)
tudi_x:
hi 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:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---if ChunkSize>1000000 then Raise EHTTPClient.Create(SErrChunkTooBig);
please advise.
thank you
tudi_x:
how would i get pass this error?
i commented the line, deleted lib folder, cleaned up and built.
i only see this chunk too big error in fphttpclient.pp.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit c_get; {$mode objfpc}{$H+} interface uses Classes, SysUtils, dateutils, fphttpclient; type TPassError = procedure(AError: string) of object; type TGETSpeed = class(TThread) private _URL: string; _Error: TPassError; procedure TriggerError(AError: string); procedure CheckSpeed(AURL: string; ABytes: longword); protected procedure Execute; override; public constructor Create(AURL: string); reintroduce; destructor Destroy(); override; property OnPassError: TPassError read _Error write _Error; end; implementation constructor TGETSpeed.Create(AURL: string);begin _URL := AURL; inherited Create(False); self.FreeOnTerminate := True;end; procedure TGETSpeed.Execute;begin CheckSpeed(_URL, 10485760);end; procedure 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; procedure TGETSpeed.TriggerError(AError: string);begin if Assigned(_Error) then _Error(AError);end; destructor TGETSpeed.Destroy();begin inherited Destroy;end; end.
tudi_x:
working with Synapse.
opened: https://bugs.freepascal.org/view.php?id=32656
Leledumbo:
--- Quote from: tudi_x on November 07, 2017, 12:03:18 pm ---how would i get pass this error?
i commented the line, deleted lib folder, cleaned up and built.
--- End quote ---
It's an fpc unit, compile the unit inside its folder (use the provided Makefile) then copy the resulting .o and .ppu to the unit path (NOT your project path).
Navigation
[0] Message Index