OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
957 stars 174 forks source link

Issue 185 (map local accesses to localhost) causes regressions #967

Closed michaelrsweet closed 1 month ago

michaelrsweet commented 1 month ago

Issue #185 introduced a change to map any HTTP request targeting the loopback interface to "localhost" in order to work around an Avahi bug. Unfortunately, this breaks access to network services that require a FQDN that just happen to resolve to 127.0.0.1 or ::1 (in addition to other addresses/network interfaces).

We need to revert that change.

michaelrsweet commented 1 month ago

[master d91acd442] Revert Host: header change (Issue #967)

[2.4.x 41b0b7891] Revert Host: header change (Issue #967)

alexpevzner commented 1 month ago

Hi @michaelrsweet,

It will cause regression when printing over ipp-usb.

In sane-airscan+ipp-usb exactly the same problem exists, but I solve it a bit different way: when somebody connects to the ipp-usb, using the loopback IP address (127.0.0.1 or ::1) but Host != "loopback", ipp-usb issues HTTP 302 redirect to the localhost with the same port, and sane-airscan follows these redirects.

If CUPS could follow HTTP redirects, at least from localhost to localhost, It will solve the problem...

michaelrsweet commented 1 month ago

@alexpevzner IPP doesn't allow HTTP redirects because (per the HTTP standards) redirects with non-idempotent requests (POST/PUT/etc) are undefined.

WRT IPP-USB printers, we should be able to update the DNS-SD resolver to use "localhost" when the hostname resolves to 127.0.0.1 or ::1. Tracking that with issue #970...