[SOLVED] TFPHTTPClient doesn't work with HTTP response 206 Partial Contect ? lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- krexon · 2019-10-22 10:10 I had never any problems with TFPHTTPClient. Until now Response of server is 206 (Partial Content). It is outside of my control. I don't use range. I can't get JSON response body. Instead of JSON, I receive only 3 chars: %1F%3F%08 (unit separator, question mark, backspace). What to do with this problem? ---------------------------------------------------------------------- Thaddy · 2019-10-22 10:28 What to do? Show code that reproduces it. (And your FPC version, Lazarus version and platform/OS) ---------------------------------------------------------------------- krexon · 2019-10-22 11:10 It's simple HTTP POST. I used it several times and I had no problems when there was response code '200 OK'. For the first time I came across that server server response is '206 Partial Content'. In this case TFPHTTPClient can't get proper response body. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses ..., fphttpclient, opensslsockets, ... with TFPHTTPClient.Create(nil) do  try      AddHeader('Content-Type', 'application/json; charset=UTF-8');      AllowRedirect := True;      RequestBody := TStringStream.Create('{JSON}');      Memo.Lines.Add(Post('https://url'));  finally    RequestBody.Free;    Free;  end; ---------------------------------------------------------------------- Handoko · 2019-10-22 11:20 Maybe it is the SSL issue which discussed recently: https://forum.lazarus.freepascal.org/index.php/topic,39206.msg308413.h tml#msg308413 ---------------------------------------------------------------------- krexon · 2019-10-22 11:40 No, it's not SSL problem. Everything works fine, except this one case. Other requests (GET and POST) to the same server, but different endpoints, works fine. ---------------------------------------------------------------------- trev · 2019-10-22 11:49 I've only ever seen HTTP 206 code responses for range requests. What is the web server software being used which gives the 206 responses? I suspect a bug... ---------------------------------------------------------------------- krexon · 2019-10-22 12:05 I don't know what web server is there. When I make the same request in different software (i.e. Visual Studio Code), there is also response with code 206, but there is also proper JSON in response body. EDIT: I tested it with standard HttpClient in Delphi 10.3.2 and I get proper JSON response. Of course response code is 206 EDIT2: I used Indy in Lazarus and response is the same like with fphttpclient (only 3 chars) EDIT3: I made simple console application in Lazarus to easy compile with different version of fpc. After compiling program with FPC version I use now 3.3.1 rev 43202 I saw in console that response is much longer than 3 chars. It is: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i       íýGŽ$IŇĽ˙_% kK?t9÷]´g 3˛"#'ČE"P°t 7"┼yŔÍ<?DÜ˝ŕîYQžé'?¬* 6?XD¨¨ą«ë#ęfËĐ┼ć'!0B? J/?"JÚa<'Ą┼(!? 'Úp<[%"p3qYBa:'47"Ó Ţż4?o"XçJĆÂ]˙îR˙ŃţÄeĆd&Ívn¸cď9t*Mę(_ŻĄÖ2Wü!Â"Ĺ (Ä3/'+\Ą|˙ÄeÖ¨|('"/ŤXl7Uú|1ë˙żZŚ┼ă ČňgˇMÄu:QŮ6Ęu??z'TRŇw"&ä×Âi.ŃKŇ ű*cRĐč/°c?RRgĆ\§Ú.&;ôÖŇJĹž|[CH=lx!|<ţÁWbĆŤĐ3aĘB%ÂGžiŃčĺC&ăZŞ8+' ÇyÝhňvčC 7đJÄP7'ćYO'Ŕ¤b-t_%?L¬E]Ń=u[v Ďđň,YYž"ß?Âl{R÷Tnz<6ňITĚň¤Ę%fóď!a¸Ěš<52 EDIT4: Finally I managed to make it work I added request header and it returns proper JSON in body Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i xxx- language : en-GBI don't know why it has be added only in lazarus and not elsewhere.