Open
Conversation
ngates87
commented
Mar 4, 2021
- Added option to allow localhost traffic through unchallenged.
- cleaned up formatting
erikdubbelboer
requested changes
Mar 5, 2021
Comment on lines
+1545
to
+1548
| char* localhost = "localhost"; | ||
| int localhostLen = strlen(localhost); | ||
| char* loopback = "127.0.0.1"; | ||
| int loopbackLen = strlen(loopback); |
There was a problem hiding this comment.
These don't change so you can make them static.
Comment on lines
+146
to
+153
| const int isLocalHost = ngx_http_auth_digest_is_loopback(&(r->headers_in.server)) == 0; | ||
|
|
||
| if (isLocalHost) { | ||
| const int isLocalHostBypass = ngx_strcmp(alcf->allow_localhost.data, "on") == 0; | ||
| if (isLocalHostBypass) { | ||
| return NGX_DECLINED; | ||
| } | ||
| } |
There was a problem hiding this comment.
The isLocalHostBypass check is much faster and will most of the time fail since the default is off.
- Can we convert
alcf->allow_localhostto anint(different variable) inngx_http_auth_digest_merge_loc_confso we just have to compare 1 int instead of a string each request? - Its better to do this test first before we do the more expensive
isLocalHosttest.
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.