Skip to content

Commit

Permalink
We now ignore certain headers without trying to forward them to the d…
Browse files Browse the repository at this point in the history
…estination.
  • Loading branch information
nbitounisxe committed Dec 9, 2024
1 parent 515f107 commit 114d8a7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ProjectGuid>{E2CEBBAF-6DF7-41E9-815D-9AD4CF90C845}</ProjectGuid>
<Version>1.0.13</Version>
<Version>1.0.14</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Projects/AWSRedrive.console/AWSRedrive.console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Version>1.0.13</Version>
<Version>1.0.14</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Projects/AWSRedrive/AWSRedrive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ProjectGuid>{E2CEBBAF-6DF7-41E9-815D-9AD4CF90C844}</ProjectGuid>
<Version>1.0.13</Version>
<Version>1.0.14</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
11 changes: 9 additions & 2 deletions Projects/AWSRedrive/HttpMessageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace AWSRedrive
public class HttpMessageProcessor : IMessageProcessor
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly string[] _ignoredHeaders = ["content-length", "host", "accept-encoding", "content-type", "accept"];

public void ProcessMessage(string message, Dictionary<string, string> attributes, ConfigurationEntry configurationEntry)
{
Expand Down Expand Up @@ -55,7 +56,10 @@ public void UnpackAttributesAsHeaders(string message, RestRequest request, Confi
var value = attribute.Value.Value.ToString();
if (!string.IsNullOrEmpty(value))
{
request.AddHeader(attribute.Key, value);
if (!_ignoredHeaders.Contains(attribute.Key.ToLower()))
{
request.AddHeader(attribute.Key, value);
}
}
}
}
Expand Down Expand Up @@ -144,7 +148,10 @@ public void AddAttributes(RestRequest request, Dictionary<string, string> attrib
{
foreach (var key in attributes.Keys.Where(key => !string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(attributes[key])))
{
request.AddHeader(key, attributes[key]);
if (!_ignoredHeaders.Contains(key.ToLower()))
{
request.AddHeader(key, attributes[key]);
}
}
}
}
Expand Down

0 comments on commit 114d8a7

Please sign in to comment.