From b260f184f8a695baf7c3672ade27815864317a6a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 6 Oct 2015 22:01:27 +0200 Subject: [PATCH] Fixed Indy to correctly assign request headers --- URestemplateApp.pas | 5 ++--- indy/Protocols/IdHTTPHeaderInfo.pas | 5 +++-- restemplate.lpi | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/URestemplateApp.pas b/URestemplateApp.pas index c54b3be..01556ab 100644 --- a/URestemplateApp.pas +++ b/URestemplateApp.pas @@ -387,6 +387,8 @@ var jsonData: TJSONData; contentType: TContentType; xmlDoc: TXMLDocument; + // + i: Integer; begin FParser.Content := AURL; FParser.Replace; @@ -412,9 +414,6 @@ begin FHttp.Request := FRequest; FHttp.HTTPOptions := FHttp.HTTPOptions + [hoNoProtocolErrorException]; - // Workaround for CustomHeaders not being assigned :-/ - FHttp.Request.CustomHeaders.AddStrings(FRequest.CustomHeaders); - if SameText('POST', FMethod) and (FFormFields.Count > 0) then FHttp.Post(AURL, FFormFields, response) else diff --git a/indy/Protocols/IdHTTPHeaderInfo.pas b/indy/Protocols/IdHTTPHeaderInfo.pas index 96d12c8..0224d81 100644 --- a/indy/Protocols/IdHTTPHeaderInfo.pas +++ b/indy/Protocols/IdHTTPHeaderInfo.pas @@ -336,6 +336,7 @@ begin begin LDest := TIdEntityHeaderInfo(Destination); LDest.FRawHeaders.Assign(FRawHeaders); + LDest.FCustomHeaders.Assign(FCustomHeaders); LDest.FCacheControl := FCacheControl; LDest.FCharSet := FCharSet; LDest.FContentDisposition := FContentDisposition; @@ -966,9 +967,9 @@ begin // TODO: omitted intentionally? // LDest.FHost := FHost; // LDest.FProxyConnection := FProxyConnection; - end else begin - inherited AssignTo(Destination); end; + + inherited AssignTo(Destination); end; procedure TIdRequestHeaderInfo.Clear; diff --git a/restemplate.lpi b/restemplate.lpi index 3497a1a..bc6d31e 100644 --- a/restemplate.lpi +++ b/restemplate.lpi @@ -19,7 +19,8 @@ - + +