From 7ebaae6a58b8cd0f20f9c6bda22f3521dbc0a377 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Fri, 1 Jun 2018 03:05:16 +0500 Subject: sstp: http: add verbose response logging --- accel-pppd/ctrl/sstp/sstp.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c index 0206b69d..c7cbfea2 100644 --- a/accel-pppd/ctrl/sstp/sstp.c +++ b/accel-pppd/ctrl/sstp/sstp.c @@ -810,12 +810,10 @@ static char *http_getvalue(char *line, const char *name, int len) static int http_send_response(struct sstp_conn_t *conn, char *proto, char *status, char *headers) { char datetime[sizeof("aaa, dd bbb yyyy HH:MM:SS GMT")]; - struct buffer_t *buf; + char linebuf[1024], *line; + struct buffer_t *buf, tmp; time_t now = time(NULL); - if (conf_verbose) - log_ppp_info2("send [HTTP <%s %s>]\n", proto, status); - strftime(datetime, sizeof(datetime), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&now)); buf = alloc_buf_printf( "%s %s\r\n" @@ -828,6 +826,15 @@ static int http_send_response(struct sstp_conn_t *conn, char *proto, char *statu return -1; } + if (conf_verbose) { + tmp = *buf; + while ((line = http_getline(&tmp, linebuf, sizeof(linebuf))) != NULL) { + if (*line == '\0') + break; + log_ppp_info2("send [HTTP <%s>]\n", line); + } + } + return sstp_send(conn, buf); } -- cgit v1.2.3