ENABLE_HTTP_DATE : add a Date: header to all HTTP responses
This commit is contained in:
parent
239739a6f7
commit
7227e55dba
|
@ -1,4 +1,7 @@
|
|||
$Id: Changelog.txt,v 1.309 2012/09/27 16:01:10 nanard Exp $
|
||||
$Id: Changelog.txt,v 1.318 2012/10/04 22:11:55 nanard Exp $
|
||||
|
||||
2012/10/03:
|
||||
ENABLE_HTTP_DATE : add a Date: header to all HTTP responses
|
||||
|
||||
2012/09/27:
|
||||
Fixes with DISABLE_CONFIG_FILE
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh
|
||||
# $Id: genconfig.sh,v 1.58 2012/06/29 19:29:55 nanard Exp $
|
||||
# $Id: genconfig.sh,v 1.61 2012/10/03 21:07:29 nanard Exp $
|
||||
# miniupnp daemon
|
||||
# http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/
|
||||
# (c) 2006-2012 Thomas Bernard
|
||||
|
@ -410,6 +410,14 @@ else
|
|||
fi
|
||||
echo "" >> ${CONFIGFILE}
|
||||
|
||||
echo "/* Add the optional Date: header in all HTTP responses */" >> ${CONFIGFILE}
|
||||
if [ -n "$STRICT" ] ; then
|
||||
echo "#define ENABLE_HTTP_DATE" >> ${CONFIGFILE}
|
||||
else
|
||||
echo "/*#define ENABLE_HTTP_DATE*/" >> ${CONFIGFILE}
|
||||
fi
|
||||
echo "" >> ${CONFIGFILE}
|
||||
|
||||
echo "/* disable reading and parsing of config file (miniupnpd.conf) */" >> ${CONFIGFILE}
|
||||
echo "/*#define DISABLE_CONFIG_FILE*/" >> ${CONFIGFILE}
|
||||
echo "" >> ${CONFIGFILE}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: upnphttp.c,v 1.76 2012/09/27 13:15:03 nanard Exp $ */
|
||||
/* $Id: upnphttp.c,v 1.81 2012/10/04 22:09:34 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* Author : Thomas Bernard
|
||||
|
@ -19,6 +19,9 @@
|
|||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include "config.h"
|
||||
#ifdef ENABLE_HTTP_DATE
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include "upnphttp.h"
|
||||
#include "upnpdescgen.h"
|
||||
#include "miniupnpdpath.h"
|
||||
|
@ -730,6 +733,21 @@ BuildHeader_upnphttp(struct upnphttp * h, int respcode,
|
|||
/* Content-Type MUST be 'text/xml; charset="utf-8"' according to UDA v1.1 */
|
||||
/* Content-Type MUST be 'text/xml' according to UDA v1.0 */
|
||||
/* Additional headers */
|
||||
#ifdef ENABLE_HTTP_DATE
|
||||
{
|
||||
char http_date[64];
|
||||
time_t t;
|
||||
struct tm tm;
|
||||
time(&t);
|
||||
gmtime_r(&t, &tm);
|
||||
/* %a and %b depend on locale */
|
||||
strftime(http_date, sizeof(http_date),
|
||||
"%a, %d %b %Y %H:%M:%S GMT", &tm);
|
||||
h->res_buflen += snprintf(h->res_buf + h->res_buflen,
|
||||
h->res_buf_alloclen - h->res_buflen,
|
||||
"Date: %s\r\n", http_date);
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_EVENTS
|
||||
if(h->respflags & FLAG_TIMEOUT) {
|
||||
h->res_buflen += snprintf(h->res_buf + h->res_buflen,
|
||||
|
|
Loading…
Reference in New Issue