1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-11-03 04:17:17 -05:00

Feature: Report invalid type for HTTP header

This commit is contained in:
Philipp Schafft 2021-06-23 09:18:58 +00:00
parent 954b8a4c39
commit aa83b3fff0
4 changed files with 12 additions and 9 deletions

View File

@ -212,7 +212,8 @@ acl_t *acl_new_from_xml_node(xmlNodePtr node)
if (xmlIsBlankNode(child)) if (xmlIsBlankNode(child))
continue; continue;
if (xmlStrcmp(child->name, XMLSTR("http-headers")) == 0) { if (xmlStrcmp(child->name, XMLSTR("http-headers")) == 0) {
config_parse_http_headers(child->xmlChildrenNode, &(ret->http_headers)); /* FIXME: Pass real configuration parameter here. */
config_parse_http_headers(child->xmlChildrenNode, &(ret->http_headers), NULL);
} }
} while ((child = child->next)); } while ((child = child->next));
} }

View File

@ -931,7 +931,8 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
*next_option = opt; *next_option = opt;
next_option = &opt->next; next_option = &opt->next;
} else if (xmlStrcmp (child->name, XMLSTR("http-headers")) == 0) { } else if (xmlStrcmp (child->name, XMLSTR("http-headers")) == 0) {
config_parse_http_headers(child->xmlChildrenNode, &(auth->http_headers)); /* FIXME: Pass real configuration parameter here. */
config_parse_http_headers(child->xmlChildrenNode, &(auth->http_headers), NULL);
} else if (xmlStrcmp (child->name, XMLSTR("acl")) == 0) { } else if (xmlStrcmp (child->name, XMLSTR("acl")) == 0) {
if (!auth->acl) { if (!auth->acl) {
auth->acl = acl_new_from_xml_node(child); auth->acl = acl_new_from_xml_node(child);

View File

@ -1284,7 +1284,7 @@ static void _parse_root(xmlDocPtr doc,
} else if (xmlStrcmp(node->name, XMLSTR("limits")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("limits")) == 0) {
_parse_limits(doc, node->xmlChildrenNode, configuration); _parse_limits(doc, node->xmlChildrenNode, configuration);
} else if (xmlStrcmp(node->name, XMLSTR("http-headers")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("http-headers")) == 0) {
config_parse_http_headers(node->xmlChildrenNode, &(configuration->http_headers)); config_parse_http_headers(node->xmlChildrenNode, &(configuration->http_headers), configuration);
} else if (xmlStrcmp(node->name, XMLSTR("relay")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("relay")) == 0) {
_parse_relay(doc, node->xmlChildrenNode, configuration, NULL); _parse_relay(doc, node->xmlChildrenNode, configuration, NULL);
} else if (xmlStrcmp(node->name, XMLSTR("mount")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("mount")) == 0) {
@ -1796,7 +1796,7 @@ static void _parse_mount(xmlDocPtr doc,
node->xmlChildrenNode, 1); node->xmlChildrenNode, 1);
} else if (xmlStrcmp(node->name, XMLSTR("http-headers")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("http-headers")) == 0) {
config_parse_http_headers(node->xmlChildrenNode, config_parse_http_headers(node->xmlChildrenNode,
&(mount->http_headers)); &(mount->http_headers), configuration);
} else if (xmlStrcmp(node->name, XMLSTR("event-bindings")) == 0 || } else if (xmlStrcmp(node->name, XMLSTR("event-bindings")) == 0 ||
xmlStrcmp(node->name, XMLSTR("kartoffelsalat")) == 0) { xmlStrcmp(node->name, XMLSTR("kartoffelsalat")) == 0) {
_parse_events(&mount->event, node->xmlChildrenNode); _parse_events(&mount->event, node->xmlChildrenNode);
@ -1886,7 +1886,8 @@ static void _parse_mount(xmlDocPtr doc,
} }
void config_parse_http_headers(xmlNodePtr node, void config_parse_http_headers(xmlNodePtr node,
ice_config_http_header_t **http_headers) ice_config_http_header_t **http_headers,
ice_config_t *configuration)
{ {
ice_config_http_header_t *header; ice_config_http_header_t *header;
ice_config_http_header_t *next; ice_config_http_header_t *next;
@ -1915,8 +1916,7 @@ void config_parse_http_headers(xmlNodePtr node,
} else if (strcmp(tmp, "cors") == 0 || strcmp(tmp, "corpse") == 0) { } else if (strcmp(tmp, "cors") == 0 || strcmp(tmp, "corpse") == 0) {
type = HTTP_HEADER_TYPE_CORS; type = HTTP_HEADER_TYPE_CORS;
} else { } else {
ICECAST_LOG_WARN("Unknown type %s for " __found_bad_tag(configuration, node, BTR_INVALID, tmp);
"HTTP Header %s", tmp, name);
xmlFree(tmp); xmlFree(tmp);
break; break;
} }
@ -2162,7 +2162,7 @@ static void _parse_listen_socket(xmlDocPtr doc,
} else if (xmlStrcmp(node->name, XMLSTR("authentication")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("authentication")) == 0) {
_parse_authentication_node(node, &(listener->authstack)); _parse_authentication_node(node, &(listener->authstack));
} else if (xmlStrcmp(node->name, XMLSTR("http-headers")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("http-headers")) == 0) {
config_parse_http_headers(node->xmlChildrenNode, &(listener->http_headers)); config_parse_http_headers(node->xmlChildrenNode, &(listener->http_headers), configuration);
} else { } else {
__found_bad_tag(configuration, node, BTR_UNKNOWN, NULL); __found_bad_tag(configuration, node, BTR_UNKNOWN, NULL);
} }

View File

@ -334,7 +334,8 @@ config_options_t *config_parse_options(xmlNodePtr node);
void config_clear_options(config_options_t *options); void config_clear_options(config_options_t *options);
void config_parse_http_headers(xmlNodePtr node, void config_parse_http_headers(xmlNodePtr node,
ice_config_http_header_t **http_headers); ice_config_http_header_t **http_headers,
ice_config_t *configuration);
void config_clear_http_header(ice_config_http_header_t *header); void config_clear_http_header(ice_config_http_header_t *header);
int config_rehash(void); int config_rehash(void);