Commit d9e96a55 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Feature: Allow <resource> to match on a specific listen-socket

parent 2febabcd
Pipeline #239 passed with stage
in 45 seconds
......@@ -596,6 +596,7 @@ static void config_clear_resource(resource_t *resource)
xmlFree(resource->vhost);
xmlFree(resource->module);
xmlFree(resource->handler);
free(resource->listen_socket);
free(resource);
resource = nextresource;
}
......@@ -2007,6 +2008,12 @@ static void _parse_resource(xmlDocPtr doc,
resource->bind_address = (char *)xmlGetProp(node, XMLSTR("bind-address"));
temp = (char *)xmlGetProp(node, XMLSTR("listen-socket"));
if (temp) {
resource->listen_socket = config_href_to_id(temp);
xmlFree(temp);
}
resource->vhost = (char *)xmlGetProp(node, XMLSTR("vhost"));
resource->module = (char *)xmlGetProp(node, XMLSTR("module"));
......
......@@ -139,6 +139,7 @@ typedef struct _resource {
char *destination;
int port;
char *bind_address;
char *listen_socket;
char *vhost;
char *module;
char *handler;
......
......@@ -1176,6 +1176,9 @@ static int _handle_resources(client_t *client, char **uri)
if (resource->bind_address != NULL && serverhost != NULL && strcmp(resource->bind_address, serverhost) != 0)
continue;
if (resource->listen_socket != NULL && (listen_sock->id == NULL || strcmp(resource->listen_socket, listen_sock->id) != 0))
continue;
/* Check for the vhost to match. */
if (resource->vhost != NULL && vhost != NULL && strcmp(resource->vhost, vhost) != 0)
continue;
......
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