Commit 4aabe93d authored by Jussi Kukkonen's avatar Jussi Kukkonen Committed by Jens Georg
Browse files

Return 400 to NOTIFYs without NT or NTS header

We used to return 412 if the "NT" or "NTS" header field was missing.
Spec says we should return 400.

https://bugzilla.gnome.org/show_bug.cgi?id=698192
parent be0665b4
......@@ -1818,7 +1818,7 @@ server_handler (SoupServer *soup_server,
gpointer user_data)
{
GUPnPServiceProxy *proxy;
const char *hdr;
const char *hdr, *nt, *nts;
int seq;
xmlDoc *doc;
xmlNode *node;
......@@ -1833,17 +1833,18 @@ server_handler (SoupServer *soup_server,
return;
}
hdr = soup_message_headers_get_one (msg->request_headers, "NT");
if (hdr == NULL || strcmp (hdr, "upnp:event") != 0) {
/* Proper NT header lacking */
soup_message_set_status (msg, SOUP_STATUS_PRECONDITION_FAILED);
nt = soup_message_headers_get_one (msg->request_headers, "NT");
nts = soup_message_headers_get_one (msg->request_headers, "NTS");
if (nt == NULL || nts == NULL) {
/* Required header is missing */
soup_message_set_status (msg, SOUP_STATUS_BAD_REQUEST);
return;
}
hdr = soup_message_headers_get_one (msg->request_headers, "NTS");
if (hdr == NULL || strcmp (hdr, "upnp:propchange") != 0) {
/* Proper NTS header lacking */
if (strcmp (nt, "upnp:event") != 0 ||
strcmp (nts, "upnp:propchange") != 0) {
/* Unexpected header content */
soup_message_set_status (msg, SOUP_STATUS_PRECONDITION_FAILED);
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment