Commit e8db81e3 authored by Sergey Lyubka's avatar Sergey Lyubka

SSL error logging my Martin Lamb

parent 57157edc
...@@ -477,7 +477,8 @@ cry(struct mg_connection *conn, const char *fmt, ...) ...@@ -477,7 +477,8 @@ cry(struct mg_connection *conn, const char *fmt, ...)
(void) fprintf(fp, "%s", buf); (void) fprintf(fp, "%s", buf);
fputc('\n', fp); fputc('\n', fp);
funlockfile(fp); funlockfile(fp);
if (fp != stderr) fclose(fp); if (fp != stderr)
fclose(fp);
} }
} }
conn->request_info.log_message = NULL; conn->request_info.log_message = NULL;
...@@ -488,16 +489,16 @@ cry(struct mg_connection *conn, const char *fmt, ...) ...@@ -488,16 +489,16 @@ cry(struct mg_connection *conn, const char *fmt, ...)
*/ */
static void ssl_cry(struct mg_connection *conn, const char *fmt, ...) { static void ssl_cry(struct mg_connection *conn, const char *fmt, ...) {
char buf[BUFSIZ]; char buf[BUFSIZ];
unsigned long err;
va_list ap; va_list ap;
/* first just log the mongoose-level error message passed in via fmt, etc. */ /* Log Mongoose message */
va_start(ap, fmt); va_start(ap, fmt);
(void) vsnprintf(buf, sizeof(buf), fmt, ap); (void) vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap); va_end(ap);
cry(conn, buf); cry(conn, buf);
/* then loop through any unlogged OpenSSL errors */ /* Loop through any unlogged OpenSSL errors */
unsigned long err;
while ((err = ERR_get_error()) != 0) { while ((err = ERR_get_error()) != 0) {
cry(conn, " --> OpenSSL: %s", ERR_error_string(err, NULL)); cry(conn, " --> OpenSSL: %s", ERR_error_string(err, NULL));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment