querter 0 Posted February 12 Hello @Remy, // #409: Add ValueFromIndex[] property to TIdHeaderList // Open - rlebeau opened this issue on Apr 25, 2022 // URL: http://github.com/IndySockets/Indy/issues/409 // #408: TIdHTTP Response.RawHeaders returns wrong value when calling ValueFromIndex[index] // lloydbates opened this issue on Apr 25, 2022 // URL: h t t p s : / / github.com/IndySockets/Indy/issues/408 unit IdHeaderList; interface TIdHeaderList = class(TStringList) protected ... {String read from a position, Index} function GetValueFromIndex(var Index: Integer): string; {String inserts into a position, Index} procedure SetValueFromIndex(var Index: Integer; const Value: string); public ... property ValueFromIndex[var Index: Integer]: string read GetValueFromIndex write SetValueFromIndex; end; implementation ... function TIdHeaderList.GetValueFromIndex(var Index: Integer): string; begin Result := GetValueFromLine(Index); end; procedure TIdHeaderList.SetValueFromIndex(var Index: Integer; const Value: string); begin SetValue(Names[Index], Value); end; For the test, I deliberately set the fold length to 20 characters (very narrow) in order to get a lot of line breaks. File attachment:: Test-Routine.pas and detailed result list: FoldLength: 20 --------- --------- // Test FOR..TO ValueFromIndex[] FoldLines convert // #408; lloydbates commented on Apr 25, 2022 // h t t p s : / / github.com/IndySockets/Indy/issues/408#issue-1214406965 --------- 1 : Server OK "nginx" 2 : Date OK "Mon, 12 Feb 2024 21:10:33 GMT" 3 : Content-Type OK "text/html; charset=UTF-8" 6 : Transfer-Encoding OK "chunked" 8 : Connection OK "keep-alive" 10: Vary OK "Accept-Encoding" 11: Expires OK "-1" 12: Cache-Control OK "no-cache" 14: pragma OK "no-cache" 15: Set-Cookie OK "sid=cdd161af06b475cdd843009db42d4963; path=/" 18: X-Cache-Status OK "MISS" 19: Content-Language OK "de,at,ch" 21: Text1 OK "#Short-Text#" 22: Text2 OK "#Modifications - Ut wisi enim ad minim veniam, ..." 35: Text3 OK "#Long-Text - Ut wisi enim ad minim veniam, quis ..." 48: Text4 OK "#Short-Text - two#" --------- // Test FOR..TO ValueFromIndex[] FoldLines convert // #408: rlebeau commented on Apr 25, 2022 // h t t p s : / / github.com/IndySockets/Indy/issues/408#issuecomment-1108769280 --------- 1 : Server OK "nginx" 2 : Date OK "Mon, 12 Feb 2024 21:10:33 GMT" 3 : Content-Type OK "text/html; charset=UTF-8" 4 : Transfer-Encoding OK "chunked" 5 : Connection OK "keep-alive" 6 : Vary OK "Accept-Encoding" 7 : Expires OK "-1" 8 : Cache-Control OK "no-cache" 9 : pragma OK "no-cache" 10: Set-Cookie OK "sid=cdd161af06b475cdd843009db42d4963; path=/" 11: X-Cache-Status OK "MISS" 12: Content-Language OK "de,at,ch" 13: Text1 OK "#Short-Text#" 14: Text2 OK "#Modifications - Ut wisi enim ad minim veniam, quis ..." 15: Text3 OK "#Long-Text - Ut wisi enim ad minim veniam, quis nostrud ..." 16: Text4 OK "#Short-Text - two#" --------- HeaderList_ValueFromIndex_Console.dpr result.txt Share this post Link to post
Remy Lebeau 1421 Posted February 13 I appreciate the effort. I have added the info to the existing ticket. Share this post Link to post