From: Zdenek Dohnal Date: Mon, 19 Oct 2020 05:59:49 +0000 (+0200) Subject: cups/ipp-vars.c: support mdns URI in _ippVarsSet() X-Git-Tag: v2.3.3op1~64^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5%2Fhead;p=thirdparty%2Fcups.git cups/ipp-vars.c: support mdns URI in _ippVarsSet() --- 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);