]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
cups/ipp-vars.c: support mdns URI in _ippVarsSet() 5/head
authorZdenek Dohnal <zdohnal@redhat.com>
Mon, 19 Oct 2020 05:59:49 +0000 (07:59 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Mon, 19 Oct 2020 05:59:49 +0000 (07:59 +0200)
cups/ipp-vars.c

index f7538a4eac859a6e0722b63a148d17155d75a327..ada3d3a17148ac8708dc526d1f371300bede412d 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <cups/cups.h>
+#include <cups/cups-private.h>
 #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);