Support multiple IP addresses for http_x_forwarded_for#45
Open
conradolega wants to merge 1 commit intosatyrius:masterfrom
Open
Support multiple IP addresses for http_x_forwarded_for#45conradolega wants to merge 1 commit intosatyrius:masterfrom
http_x_forwarded_for#45conradolega wants to merge 1 commit intosatyrius:masterfrom
Conversation
5cf8f83 to
8e4ca23
Compare
satyrius
requested changes
Nov 29, 2019
| gonx "../.." | ||
| "flag" | ||
| "fmt" | ||
| gonx "github.com/satyrius/gonx" |
Owner
There was a problem hiding this comment.
Why did you change it from relative path? It was very convenient for development.
| - 1.3 | ||
| - 1.4 | ||
| - 1.5 | ||
| - 1.12 |
Owner
There was a problem hiding this comment.
Sort versions alphabetically plz
parser.go
Outdated
|
|
||
| func getSpecialNginxRegexes() map[string]string { | ||
| return map[string]string{ | ||
| "http_x_forwarded_for": `[^, ]*(?:, [^, ]+)*`} |
Owner
There was a problem hiding this comment.
The formatting looks off on those lines above. Can you double check gofmt plz?
| } else { | ||
| re = strings.Replace(re, field[2]+field[4], regexp.QuoteMeta(field[1])+"(?P<"+field[2]+">[^"+terminateChar+"]*)"+regexp.QuoteMeta(field[3]+field[4]), 1) | ||
| } | ||
| } |
Owner
There was a problem hiding this comment.
For the patch above, please, consider adding more comments around to explain what's going on.
| if specialRegex, found := specialNginxRegexes[field[2]]; found { | ||
| re = strings.Replace(re, field[2]+field[4], regexp.QuoteMeta(field[1])+"(?P<"+field[2]+">"+specialRegex+")"+regexp.QuoteMeta(field[3])+field[4], 1) | ||
| } else { | ||
| re = strings.Replace(re, field[2]+field[4], regexp.QuoteMeta(field[1])+"(?P<"+field[2]+">[^"+terminateChar+"]*)"+regexp.QuoteMeta(field[3]+field[4]), 1) |
Owner
There was a problem hiding this comment.
Looks like code duplication, please, make it more readable.
Owner
|
@conradolega are you interested in wrapping this up? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This improves upon #37 by fixing some errors, and rebases it on top of master.
I've also updated the CI job to run against 1.12. It should also pass against Go's
tipversion.Fixes #36.