diff --git a/miniupnpd/upnphttp.c b/miniupnpd/upnphttp.c index f5bb245..b6241fb 100644 --- a/miniupnpd/upnphttp.c +++ b/miniupnpd/upnphttp.c @@ -308,6 +308,11 @@ ParseHttpHeaders(struct upnphttp * h) syslog(LOG_DEBUG, "\"Expect: 100-Continue\" header detected"); } } + else if(strncasecmp(line, "user-agent:", 11) == 0) + { + if(strcasestr(line + 11, "microsoft") != NULL) + h->respflags |= FLAG_MS_CLIENT; + } #ifdef ENABLE_EVENTS else if(strncasecmp(line, "Callback:", 9)==0) { @@ -463,7 +468,11 @@ sendXMLdesc(struct upnphttp * h, char * (f)(int *, int)) char * desc; int len; #ifdef IGD_V2 - desc = f(&len, GETFLAG(FORCEIGDDESCV1MASK)); +#ifdef DEBUG + if(h->respflags & FLAG_MS_CLIENT) + syslog(LOG_DEBUG, "MS Client, forcing IGD v1"); +#endif /* DEBUG */ + desc = f(&len, GETFLAG(FORCEIGDDESCV1MASK) || (h->respflags & FLAG_MS_CLIENT)); #else desc = f(&len, 0); #endif diff --git a/miniupnpd/upnphttp.h b/miniupnpd/upnphttp.h index 9d9cf48..3bc7215 100644 --- a/miniupnpd/upnphttp.h +++ b/miniupnpd/upnphttp.h @@ -2,7 +2,7 @@ /* vim: tabstop=4 shiftwidth=4 noexpandtab * MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2020 Thomas Bernard + * (c) 2006-2021 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -106,6 +106,9 @@ struct upnphttp { #define FLAG_ALLOW_POST 0x100 #define FLAG_ALLOW_SUB_UNSUB 0x200 +/* If set, the User-Agent: contains "microsoft" */ +#define FLAG_MS_CLIENT 0x400 + #ifdef ENABLE_HTTPS int init_ssl(void); void free_ssl(void);