From 64ac6626d89ff6a8c06b4b2355e8a059f17ff3bd Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Mon, 19 Oct 2020 07:59:49 +0200 Subject: [PATCH] cups/ipp-vars.c: support mdns URI in _ippVarsSet() --- cups/ipp-vars.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cups/ipp-vars.c b/cups/ipp-vars.c index f7538a4eac..ada3d3a171 100644 --- a/cups/ipp-vars.c +++ b/cups/ipp-vars.c @@ -13,6 +13,7 @@ */ #include +#include #include "ipp-private.h" #include "string-private.h" #include "debug-internal.h" @@ -221,6 +222,21 @@ _ippVarsSet(_ipp_vars_t *v, /* I - IPP variables */ if (!strcmp(name, "uri")) { char uri[1024]; /* New printer URI */ + char resolved[1024]; /* Resolved mDNS URI */ + + if (strstr(value, "._tcp")) + { + /* + * Resolve URI... + */ + + if (!_httpResolveURI(value, resolved, sizeof(resolved), _HTTP_RESOLVE_DEFAULT, NULL, NULL)) + { + return (0); + } + + value = resolved; + } if (httpSeparateURI(HTTP_URI_CODING_ALL, value, v->scheme, sizeof(v->scheme), v->username, sizeof(v->username), v->host, sizeof(v->host), &(v->port), v->resource, sizeof(v->resource)) < HTTP_URI_STATUS_OK) return (0); -- 2.47.2