forked from fukusaka/nginx-http-auth-digest
-
Notifications
You must be signed in to change notification settings - Fork 15
Added localhost bypass option #23
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
Open
ngates87
wants to merge
4
commits into
atomx:master
Choose a base branch
from
daktronics:localhost-bypass-opt
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isLocalHostBypass
check is much faster and will most of the time fail since the default is off
.
- Can we convert
alcf->allow_localhost
to anint
(different variable) inngx_http_auth_digest_merge_loc_conf
so 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
isLocalHost
test.
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.