miniupnpd: Better comment snprintf() used to build HTTP headers

This commit is contained in:
Thomas Bernard 2021-05-22 23:30:05 +02:00
parent 08ae9e9e71
commit acca60a365
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
2 changed files with 20 additions and 16 deletions

View File

@ -553,25 +553,27 @@ SendSSDPResponse(int s, const struct sockaddr * addr,
"CONFIGID.UPNP.ORG: %u\r\n" /* UDA v1.1 */ "CONFIGID.UPNP.ORG: %u\r\n" /* UDA v1.1 */
"\r\n", "\r\n",
#ifdef ENABLE_HTTP_DATE #ifdef ENABLE_HTTP_DATE
http_date, http_date, /* DATE: */
#endif #endif
st_len, st, suffix, st_len, st, suffix, /* ST: */
uuidvalue, st_is_uuid ? "" : "::", uuidvalue, st_is_uuid ? "" : "::", /* USN: 2/5 */
st_is_uuid ? 0 : st_len, st, suffix, st_is_uuid ? 0 : st_len, st, suffix, /* USN: 3/5 */
#ifdef DYNAMIC_OS_VERSION #ifdef DYNAMIC_OS_VERSION
os_version, os_version, /* SERVER: */
#endif #endif
host, (unsigned int)http_port, host, (unsigned int)http_port, /* LOCATION: */
#ifdef RANDOMIZE_URLS #ifdef RANDOMIZE_URLS
random_url, random_url, /* LOCATION: 3/3 */
#endif /* RANDOMIZE_URLS */ #endif /* RANDOMIZE_URLS */
#ifdef ENABLE_HTTPS #ifdef ENABLE_HTTPS
host, (unsigned int)https_port, host, (unsigned int)https_port, /* SECURELOCATION.UPNP.ORG */
#ifdef RANDOMIZE_URLS #ifdef RANDOMIZE_URLS
random_url, random_url, /* SECURELOCATION.UPNP.ORG 3/3 */
#endif /* RANDOMIZE_URLS */ #endif /* RANDOMIZE_URLS */
#endif /* ENABLE_HTTPS */ #endif /* ENABLE_HTTPS */
upnp_bootid, upnp_bootid, upnp_configid); upnp_bootid, /* 01-NLS: */
upnp_bootid, /* BOOTID.UPNP.ORG: */
upnp_configid); /* CONFIGID.UPNP.ORG: */
if(l<0) if(l<0)
{ {
syslog(LOG_ERR, "%s: snprintf failed %m", syslog(LOG_ERR, "%s: snprintf failed %m",
@ -691,7 +693,7 @@ SendSSDPNotify(int s, const struct sockaddr * dest, socklen_t dest_len,
#endif /* RANDOMIZE_URLS */ #endif /* RANDOMIZE_URLS */
#endif /* ENABLE_HTTPS */ #endif /* ENABLE_HTTPS */
#ifdef DYNAMIC_OS_VERSION #ifdef DYNAMIC_OS_VERSION
os_version, os_version, /* SERVER: */
#endif #endif
nt, suffix, /* NT: */ nt, suffix, /* NT: */
usn1, usn2, usn3, suffix, /* USN: */ usn1, usn2, usn3, suffix, /* USN: */
@ -1384,7 +1386,9 @@ SendSSDPbyebye(int s, const struct sockaddr * dest, socklen_t destlen,
dest_str, SSDP_PORT, /* HOST : */ dest_str, SSDP_PORT, /* HOST : */
nt, suffix, /* NT: */ nt, suffix, /* NT: */
usn1, usn2, usn3, suffix, /* USN: */ usn1, usn2, usn3, suffix, /* USN: */
upnp_bootid, upnp_bootid, upnp_configid); upnp_bootid, /* 01-NLS: */
upnp_bootid, /* BOOTID.UPNP.ORG: */
upnp_configid); /* CONFIGID.UPNP.ORG: */
if(l<0) if(l<0)
{ {
syslog(LOG_ERR, "%s: snprintf error", "SendSSDPbyebye()"); syslog(LOG_ERR, "%s: snprintf error", "SendSSDPbyebye()");

View File

@ -1117,12 +1117,12 @@ BuildHeader_upnphttp(struct upnphttp * h, int respcode,
} }
h->res_sent = 0; h->res_sent = 0;
h->res_buflen = snprintf(h->res_buf, h->res_buf_alloclen, h->res_buflen = snprintf(h->res_buf, h->res_buf_alloclen,
httpresphead, h->HttpVer, httpresphead, h->HttpVer, /* HTTP/x.x */
respcode, respmsg, respcode, respmsg,
(h->respflags&FLAG_HTML)?"text/html":"text/xml; charset=\"utf-8\"", (h->respflags&FLAG_HTML)?"text/html":"text/xml; charset=\"utf-8\"", /* Content-Type: */
bodylen bodylen /* Content-Length: */
#ifdef DYNAMIC_OS_VERSION #ifdef DYNAMIC_OS_VERSION
, os_version , os_version /* Server: */
#endif #endif
); );
/* Content-Type MUST be 'text/xml; charset="utf-8"' according to UDA v1.1 */ /* Content-Type MUST be 'text/xml; charset="utf-8"' according to UDA v1.1 */