comparison src/core/ngx_proxy_protocol.c @ 8071:017fd847f4f7

Log only the first line of user input on PROXY protocol v1 error. Previously, all received user input was logged. If a multi-line text was received from client and logged, it could reduce log readability and also make it harder to parse nginx log by scripts. The change brings to PROXY protocol the same behavior that exists for HTTP request line in ngx_http_log_error_handler().
author Roman Arutyunyan <arut@nginx.com>
date Mon, 10 Oct 2022 13:57:31 +0400
parents 89adf49fe76a
children cca4c8a715de
comparison
equal deleted inserted replaced
8070:ba5cf8f73a2d 8071:017fd847f4f7
137 } 137 }
138 } 138 }
139 139
140 invalid: 140 invalid:
141 141
142 for (p = buf; p < last; p++) {
143 if (*p == CR || *p == LF) {
144 break;
145 }
146 }
147
142 ngx_log_error(NGX_LOG_ERR, c->log, 0, 148 ngx_log_error(NGX_LOG_ERR, c->log, 0,
143 "broken header: \"%*s\"", (size_t) (last - buf), buf); 149 "broken header: \"%*s\"", (size_t) (p - buf), buf);
144 150
145 return NULL; 151 return NULL;
146 } 152 }
147 153
148 154