Skip to content

Nginx::Request#authority doesn't return userinfo #410

@yyamano

Description

@yyamano

Nginx::Request#authority doesn't return userinfo.

% curl http://yyamano:pass@localhost:58080/authority
localhost:58080
% curl http://localhost:58080/authority
localhost:58080
        location /authority {
          mruby_content_handler_code 'Nginx.rputs Nginx::Request.new.authority.to_s';
        }

It just returns HOST header field that contains only host and port.

static mrb_value ngx_mrb_get_request_var_authority(mrb_state *mrb, mrb_value self)
{
  mrb_value v = ngx_mrb_get_request_var(mrb, self);
  return mrb_funcall(mrb, v, "http_host", 0, NULL);
}

https://tools.ietf.org/html/rfc7230#section-5.4

   The "Host" header field in a request provides the host and port
   information from the target URI, enabling the origin server to
   distinguish among resources while servicing requests for multiple
   host names on a single IP address.

     Host = uri-host [ ":" port ] ; Section 2.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions