Skip to content

[Amazon.Lambda.RuntimeSupport] fix: Find header key with insensitive comparison #2094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .autover/changes/9f639a1b-3cd4-41ec-9d56-d6e95cb32b14.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Projects": [
{
"Name": "Amazon.Lambda.RuntimeSupport",
"Type": "Patch",
"ChangelogMessages": [
"Fix issue making HTTP header comparisons be case insensitive"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;

Expand All @@ -28,12 +29,14 @@ internal class RuntimeApiHeaders

public RuntimeApiHeaders(Dictionary<string, IEnumerable<string>> headers)
{
DeadlineMs = GetHeaderValueOrNull(headers, HeaderDeadlineMs);
AwsRequestId = GetHeaderValueRequired(headers, HeaderAwsRequestId);
ClientContextJson = GetHeaderValueOrNull(headers, HeaderClientContext);
CognitoIdentityJson = GetHeaderValueOrNull(headers, HeaderCognitoIdentity);
InvokedFunctionArn = GetHeaderValueOrNull(headers, HeaderInvokedFunctionArn);
TraceId = GetHeaderValueOrNull(headers, HeaderTraceId);
var caseInsensitiveHeaders = new Dictionary<string, IEnumerable<string>>(headers, StringComparer.OrdinalIgnoreCase);

DeadlineMs = GetHeaderValueOrNull(caseInsensitiveHeaders, HeaderDeadlineMs);
AwsRequestId = GetHeaderValueRequired(caseInsensitiveHeaders, HeaderAwsRequestId);
ClientContextJson = GetHeaderValueOrNull(caseInsensitiveHeaders, HeaderClientContext);
CognitoIdentityJson = GetHeaderValueOrNull(caseInsensitiveHeaders, HeaderCognitoIdentity);
InvokedFunctionArn = GetHeaderValueOrNull(caseInsensitiveHeaders, HeaderInvokedFunctionArn);
TraceId = GetHeaderValueOrNull(caseInsensitiveHeaders, HeaderTraceId);
}

public string AwsRequestId { get; private set; }
Expand All @@ -58,5 +61,4 @@ private string GetHeaderValueOrNull(Dictionary<string, IEnumerable<string>> head
return null;
}
}

}
Loading