mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
OCSP stapling: log error data in ngx_ssl_error().
It's hard to debug OCSP_basic_verify() failures without the actual error string it records in the error data field.
This commit is contained in:
parent
872563a64d
commit
1a07a7f2de
@ -1590,10 +1590,12 @@ ngx_ssl_clear_error(ngx_log_t *log)
|
|||||||
void ngx_cdecl
|
void ngx_cdecl
|
||||||
ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, char *fmt, ...)
|
ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, char *fmt, ...)
|
||||||
{
|
{
|
||||||
u_long n;
|
int flags;
|
||||||
va_list args;
|
u_long n;
|
||||||
u_char *p, *last;
|
va_list args;
|
||||||
u_char errstr[NGX_MAX_CONF_ERRSTR];
|
u_char *p, *last;
|
||||||
|
u_char errstr[NGX_MAX_CONF_ERRSTR];
|
||||||
|
const char *data;
|
||||||
|
|
||||||
last = errstr + NGX_MAX_CONF_ERRSTR;
|
last = errstr + NGX_MAX_CONF_ERRSTR;
|
||||||
|
|
||||||
@ -1605,14 +1607,14 @@ ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, char *fmt, ...)
|
|||||||
|
|
||||||
for ( ;; ) {
|
for ( ;; ) {
|
||||||
|
|
||||||
n = ERR_get_error();
|
n = ERR_peek_error_line_data(NULL, NULL, &data, &flags);
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p >= last) {
|
if (p >= last) {
|
||||||
continue;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
@ -1622,6 +1624,15 @@ ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, char *fmt, ...)
|
|||||||
while (p < last && *p) {
|
while (p < last && *p) {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p < last && *data && (flags & ERR_TXT_STRING)) {
|
||||||
|
*p++ = ':';
|
||||||
|
p = ngx_cpystrn(p, (u_char *) data, last - p);
|
||||||
|
}
|
||||||
|
|
||||||
|
next:
|
||||||
|
|
||||||
|
(void) ERR_get_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_error(level, log, err, "%s)", errstr);
|
ngx_log_error(level, log, err, "%s)", errstr);
|
||||||
|
Loading…
Reference in New Issue
Block a user