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