Skip to content
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

lambdaurl: Populate RemoteAddr with SourceIP #546

Merged
merged 1 commit into from Jan 11, 2024

Conversation

lyoung-confluent
Copy link
Contributor

Currently when using the lamdbaurl package the RemoteAddr field of the parsed *http.Request is not populated:

// RemoteAddr allows HTTP servers and other software to record
// the network address that sent the request, usually for
// logging. This field is not filled in by ReadRequest and
// has no defined format. The HTTP server in this package
// sets RemoteAddr to an "IP:port" address before invoking a
// handler.
// This field is ignored by the HTTP client.
RemoteAddr string

This PR changes the behavior to populate the value from the underlying request context. This matches the behavior of other AWS libraries: https://github.com/awslabs/aws-lambda-go-api-proxy/blob/09c9b90f1fd1a45c05eb3a2a7a166526fcddabd8/core/requestv2.go#L168

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cce0845) 72.93% compared to head (468b645) 72.95%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #546      +/-   ##
==========================================
+ Coverage   72.93%   72.95%   +0.01%     
==========================================
  Files          26       26              
  Lines        1456     1457       +1     
==========================================
+ Hits         1062     1063       +1     
  Misses        322      322              
  Partials       72       72              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bmoffatt
Copy link
Collaborator

Nice, thanks!

@bmoffatt bmoffatt merged commit 3a93ed1 into aws:main Jan 11, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants