-
Notifications
You must be signed in to change notification settings - Fork 104
Adding set_misc_base32_alphabet directive to allow the use of custom alphabets #20
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
Changes from all commits
b6f2a92
5b90edd
710a737
64b5de2
679a6f6
7836ddf
450e7b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -333,6 +333,15 @@ static ngx_command_t ngx_http_set_misc_commands[] = { | |
offsetof(ngx_http_set_misc_loc_conf_t, base32_padding), | ||
NULL | ||
}, | ||
{ | ||
ngx_string("set_misc_base32_alphabet"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like the directive name to be simpler: |
||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF | ||
|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, | ||
ngx_conf_set_str_slot, | ||
NGX_HTTP_LOC_CONF_OFFSET, | ||
offsetof(ngx_http_set_misc_loc_conf_t, base32_alphabet), | ||
NULL | ||
}, | ||
{ | ||
ngx_string("set_encode_base32"), | ||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF | ||
|
@@ -466,13 +475,22 @@ ngx_http_set_misc_create_loc_conf(ngx_conf_t *cf) | |
char * | ||
ngx_http_set_misc_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) | ||
{ | ||
ngx_uint_t i; | ||
|
||
ngx_http_set_misc_loc_conf_t *prev = parent; | ||
ngx_http_set_misc_loc_conf_t *conf = child; | ||
|
||
ngx_conf_merge_value(conf->base32_padding, prev->base32_padding, 1); | ||
|
||
ngx_conf_merge_str_value(conf->base32_alphabet, prev->base32_alphabet, | ||
"0123456789abcdefghijklmnopqrstuv"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Anyway, I'll fix both issues myself during the merge. Just FYI :) (BTW, you can always run your tests with valgrind by setting the environment variable |
||
|
||
ngx_conf_merge_value(conf->current, prev->current, NGX_CONF_UNSET); | ||
|
||
for (i = 0; i < 32; i++) { | ||
conf->basis32[conf->base32_alphabet.data[i]] = i; | ||
} | ||
|
||
return NGX_CONF_OK; | ||
} | ||
|
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.
Style, the 2nd line should align with the char right after
(
according to nginx's coding style. I'll fix it myself during the merge.