[PATCH] Allow modules to set headers_in.user

Erik Dubbelboer erik at dubbelboer.com
Sun Aug 23 06:21:30 UTC 2015


Any update on this?

On Sun, Aug 16, 2015 at 7:26 PM, Erik Dubbelboer <erik at dubbelboer.com>
wrote:

> # HG changeset patch
> # User Erik Dubbelboer <erik at dubbelboer.com>
> # Date 1439715629 0
> # Node ID c6f0f112eb446b7ab4bc69c9e4e594dd79ca3293
> # Parent  bd55d75a1410502a9b4ac6fb44ec4528437b530a
> Allow modules to set headers_in.user
>
> Requesting $remote_user will always call ngx_http_auth_basic_user
> which will always overwrite headers_in.user.
> Modules that specify different modes of authentication,
> such as Digest, can not set $remote_use without this patch.
>
> diff -r bd55d75a1410 -r c6f0f112eb44 src/http/ngx_http_core_module.c
> --- a/src/http/ngx_http_core_module.c    Sun Aug 16 10:51:34 2015 +0300
> +++ b/src/http/ngx_http_core_module.c    Sun Aug 16 09:00:29 2015 +0000
> @@ -2049,8 +2049,13 @@
>      ngx_str_t   auth, encoded;
>      ngx_uint_t  len;
>
> -    if (r->headers_in.user.len == 0 && r->headers_in.user.data != NULL) {
> -        return NGX_DECLINED;
> +    if (r->headers_in.user.data != NULL) {
> +        if (r->headers_in.user.len == 0) {
> +            return NGX_DECLINED;
> +        } else {
> +            /* headers_in.user is already set, don't parse again. */
> +            return NGX_OK;
> +        }
>      }
>
>      if (r->headers_in.authorization == NULL) {
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20150823/f0e0ff16/attachment.html>


More information about the nginx-devel mailing list