improve syslog message for incoming HTTP requests

This commit is contained in:
Thomas Bernard 2015-12-16 11:26:03 +01:00
parent 6f89608a2c
commit 1ab8cf0a22
4 changed files with 18 additions and 8 deletions

View File

@ -1,4 +1,7 @@
$Id: Changelog.txt,v 1.414 2015/12/15 11:09:57 nanard Exp $
$Id: Changelog.txt,v 1.415 2015/12/16 10:21:48 nanard Exp $
2015/12/16:
improve syslog message for incoming HTTP requests
2015/12/13:
--disable-pppconn to disable WanPPPConnection

View File

@ -1,4 +1,4 @@
/* $Id: miniupnpd.c,v 1.210 2015/08/26 07:32:32 nanard Exp $ */
/* $Id: miniupnpd.c,v 1.213 2015/12/16 10:21:49 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2015 Thomas Bernard
@ -454,7 +454,9 @@ ProcessIncomingHTTP(int shttpl, const char * protocol)
char addr_str[64];
sockaddr_to_string((struct sockaddr *)&clientname, addr_str, sizeof(addr_str));
syslog(LOG_INFO, "%s connection from %s", protocol, addr_str);
#ifdef DEBUG
syslog(LOG_DEBUG, "%s connection from %s", protocol, addr_str);
#endif /* DEBUG */
if(get_lan_for_peer((struct sockaddr *)&clientname) == NULL)
{
/* The peer is not a LAN ! */
@ -495,6 +497,7 @@ ProcessIncomingHTTP(int shttpl, const char * protocol)
#else
tmp->clientaddr = clientname.sin_addr;
#endif
memcpy(tmp->clientaddr_str, addr_str, sizeof(tmp->clientaddr_str));
return tmp;
}
else

View File

@ -1,8 +1,9 @@
/* $Id: upnphttp.c,v 1.99 2014/12/09 17:25:30 nanard Exp $ */
/* $Id: upnphttp.c,v 1.103 2015/12/16 10:21:49 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab */
/* Project : miniupnp
* Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* Author : Thomas Bernard
* Copyright (c) 2005-2014 Thomas Bernard
* Copyright (c) 2005-2015 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file included in this distribution.
* */
@ -736,6 +737,7 @@ ProcessHttpQuery_upnphttp(struct upnphttp * h)
char * HttpVer;
char * p;
int i;
p = h->req_buf;
if(!p)
return;
@ -756,8 +758,8 @@ ProcessHttpQuery_upnphttp(struct upnphttp * h)
for(i = 0; i<15 && *p != '\r'; i++)
HttpVer[i] = *(p++);
HttpVer[i] = '\0';
syslog(LOG_INFO, "HTTP REQUEST : %s %s (%s)",
HttpCommand, HttpUrl, HttpVer);
syslog(LOG_INFO, "HTTP REQUEST from %s : %s %s (%s)",
h->clientaddr_str, HttpCommand, HttpUrl, HttpVer);
ParseHttpHeaders(h);
if(h->req_HostOff > 0 && h->req_HostLen > 0) {
syslog(LOG_DEBUG, "Host: %.*s", h->req_HostLen, h->req_buf + h->req_HostOff);

View File

@ -1,4 +1,5 @@
/* $Id: upnphttp.h,v 1.40 2014/12/09 16:41:21 nanard Exp $ */
/* $Id: upnphttp.h,v 1.42 2015/12/16 10:21:49 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2015 Thomas Bernard
@ -63,6 +64,7 @@ struct upnphttp {
#ifdef ENABLE_HTTPS
SSL * ssl;
#endif /* ENABLE_HTTPS */
char clientaddr_str[64]; /* used for syslog() output */
enum httpStates state;
char HttpVer[16];
/* request */