[PATCH] Rename referrer to referer in error log
Maxim Dounin
mdounin at mdounin.ru
Thu Jul 8 13:27:21 UTC 2021
Hello!
On Thu, Jul 08, 2021 at 11:17:00AM +0200, Jeremie Drouet wrote:
> # HG changeset patch
> # User Jeremie Drouet <jeremie.drouet at gmail.com>
> # Date 1625150632 -7200
> # Thu Jul 01 16:43:52 2021 +0200
> # Node ID 7db380334d2ca671b98ab7563bab9ddee501c573
> # Parent e0fdd75871e40e4c57ed405cadb94235550142c9
> Rename referrer to referer in error log
>
> According to the developer doc from mozilla, referrer should be
> written with only one R and everywhere in the nginx codebase, we
> are using referer with only one R, so to make it consistent, I
> propose you to replace referrer with two R in the error log
> message with referer with only one R.
The "Referer" HTTP header name is misspelled and written with one
R. The word is written with two Rs. In particular, it is written
with two Rs in other header names, such as "Referrer-Policy".
In the particular log message the "referrer" is a word rather than
a header name, hence it is written with two Rs.
While the word can be changed to the header name instead, I don't
think I see compelling reasons to do so.
> I'm also proposing this because of the work I'm doing on vector
> regarding a nginx log parser in which we end up having referer
> and referrer when we parse logs.
Note that nginx error logs currently cannot be parsed
automatically, see https://trac.nginx.org/nginx/ticket/191.
>
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer
> https://github.com/timberio/vector/
>
> diff -r e0fdd75871e4 -r 7db380334d2c src/http/ngx_http_request.c
> --- a/src/http/ngx_http_request.c Mon Jun 28 18:01:24 2021 +0300
> +++ b/src/http/ngx_http_request.c Thu Jul 01 16:43:52 2021 +0200
> @@ -3889,7 +3889,7 @@
> }
>
> if (r->headers_in.referer) {
> - p = ngx_snprintf(buf, len, ", referrer: \"%V\"",
> + p = ngx_snprintf(buf, len, ", referer: \"%V\"",
> &r->headers_in.referer->value);
> buf = p;
> }
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list