Mercurial > hg > nginx-quic
comparison src/event/ngx_event_openssl.c @ 4877:f2e450929c1f
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 01 Oct 2012 12:50:36 +0000 |
parents | 386a06a22c40 |
children | 82234f3f5ca2 |
comparison
equal
deleted
inserted
replaced
4876:1a008f968f6d | 4877:f2e450929c1f |
---|---|
1588 | 1588 |
1589 | 1589 |
1590 void ngx_cdecl | 1590 void ngx_cdecl |
1591 ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, char *fmt, ...) | 1591 ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, char *fmt, ...) |
1592 { | 1592 { |
1593 u_long n; | 1593 int flags; |
1594 va_list args; | 1594 u_long n; |
1595 u_char *p, *last; | 1595 va_list args; |
1596 u_char errstr[NGX_MAX_CONF_ERRSTR]; | 1596 u_char *p, *last; |
1597 u_char errstr[NGX_MAX_CONF_ERRSTR]; | |
1598 const char *data; | |
1597 | 1599 |
1598 last = errstr + NGX_MAX_CONF_ERRSTR; | 1600 last = errstr + NGX_MAX_CONF_ERRSTR; |
1599 | 1601 |
1600 va_start(args, fmt); | 1602 va_start(args, fmt); |
1601 p = ngx_vslprintf(errstr, last - 1, fmt, args); | 1603 p = ngx_vslprintf(errstr, last - 1, fmt, args); |
1603 | 1605 |
1604 p = ngx_cpystrn(p, (u_char *) " (SSL:", last - p); | 1606 p = ngx_cpystrn(p, (u_char *) " (SSL:", last - p); |
1605 | 1607 |
1606 for ( ;; ) { | 1608 for ( ;; ) { |
1607 | 1609 |
1608 n = ERR_get_error(); | 1610 n = ERR_peek_error_line_data(NULL, NULL, &data, &flags); |
1609 | 1611 |
1610 if (n == 0) { | 1612 if (n == 0) { |
1611 break; | 1613 break; |
1612 } | 1614 } |
1613 | 1615 |
1614 if (p >= last) { | 1616 if (p >= last) { |
1615 continue; | 1617 goto next; |
1616 } | 1618 } |
1617 | 1619 |
1618 *p++ = ' '; | 1620 *p++ = ' '; |
1619 | 1621 |
1620 ERR_error_string_n(n, (char *) p, last - p); | 1622 ERR_error_string_n(n, (char *) p, last - p); |
1621 | 1623 |
1622 while (p < last && *p) { | 1624 while (p < last && *p) { |
1623 p++; | 1625 p++; |
1624 } | 1626 } |
1627 | |
1628 if (p < last && *data && (flags & ERR_TXT_STRING)) { | |
1629 *p++ = ':'; | |
1630 p = ngx_cpystrn(p, (u_char *) data, last - p); | |
1631 } | |
1632 | |
1633 next: | |
1634 | |
1635 (void) ERR_get_error(); | |
1625 } | 1636 } |
1626 | 1637 |
1627 ngx_log_error(level, log, err, "%s)", errstr); | 1638 ngx_log_error(level, log, err, "%s)", errstr); |
1628 } | 1639 } |
1629 | 1640 |