]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix httpAssembleURI to not add the standard port number.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 18 Oct 2023 16:15:30 +0000 (12:15 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 18 Oct 2023 16:15:30 +0000 (12:15 -0400)
cups/http-support.c

index b1845efc0fb78adbcbc18ce58561d4ea13a9c040..f28333db0b348047fc93b2e98331f055cf4c23cc 100644 (file)
@@ -264,6 +264,13 @@ httpAssembleURI(
     }
 
     // Finish things off with the port number...
+    if (!strcmp(scheme, "http") && port == 80)
+      port = 0;
+    else if (!strcmp(scheme, "https") && port == 443)
+      port = 0;
+    else if ((!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")) && port == 631)
+      port = 0;
+
     if (port > 0)
     {
       snprintf(ptr, (size_t)(end - ptr + 1), ":%d", port);