minissdp.c: Fix SSDP packets sent with uuid as ST: header to conform to UDA

This commit is contained in:
Thomas Bernard 2013-02-07 10:59:31 +01:00
parent 5217fdc090
commit 39a1d85f7a
2 changed files with 7 additions and 2 deletions

View File

@ -2,6 +2,7 @@ $Id: Changelog.txt,v 1.328 2013/02/06 23:37:27 nanard Exp $
2013/02/07:
Add DATE: header in SSDP packets
Fix SSDP packets sent with uuid as ST: header to conform to UDA
VERSION 1.8 : released on 2013/02/06

View File

@ -324,6 +324,7 @@ SendSSDPAnnounce2(int s, const struct sockaddr * addr,
char buf[512];
char addr_str[64];
socklen_t addrlen;
int st_is_uuid;
#ifdef ENABLE_HTTP_DATE
char http_date[64];
time_t t;
@ -335,6 +336,8 @@ SendSSDPAnnounce2(int s, const struct sockaddr * addr,
"%a, %d %b %Y %H:%M:%S GMT", &tm);
#endif
st_is_uuid = (st_len == (int)strlen(uuidvalue)) &&
(memcmp(uuidvalue, st, st_len) == 0);
/*
* follow guideline from document "UPnP Device Architecture 1.0"
* uppercase is recommended.
@ -349,7 +352,7 @@ SendSSDPAnnounce2(int s, const struct sockaddr * addr,
"DATE: %s\r\n"
#endif
"ST: %.*s%s\r\n"
"USN: %s::%.*s%s\r\n"
"USN: %s%s%.*s%s\r\n"
"EXT:\r\n"
"SERVER: " MINIUPNPD_SERVER_STRING "\r\n"
"LOCATION: http://%s:%u" ROOTDESC_PATH "\r\n"
@ -362,7 +365,8 @@ SendSSDPAnnounce2(int s, const struct sockaddr * addr,
http_date,
#endif
st_len, st, suffix,
uuidvalue, st_len, st, suffix,
uuidvalue, st_is_uuid ? "" : "::",
st_is_uuid ? 0 : st_len, st, suffix,
host, (unsigned int)port,
upnp_bootid, upnp_bootid, upnp_configid);
addrlen = (addr->sa_family == AF_INET6)