Commit 1514dcc5 authored by Piotr Pawliczek's avatar Piotr Pawliczek Committed by Commit Bot

Default port for ipps protocol in printer URIs

When a port value in printer URI is not specified, the default port
number assigned to the URI protocol is assumed. However, for ipps
protocol the default port number in ChromeOS is 443, while in CUPS
the value 631 is assumed. As a results, CUPS tries to connect to
port 631 when the port 443 is specified on ChromeOS side. This patch
solves this issue by enforcing presence of port number in all URI
sent to CUPS.

BUG=b:172961564
TEST=tested on atlas device by checking URIs in CUPS with lpstat -v

Change-Id: I0a00ab2f9230a8a159483da4370df15d86f58bab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2538254
Commit-Queue: Piotr Pawliczek <pawliczek@chromium.org>
Reviewed-by: default avatarSean Kau <skau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828411}
parent a1ff9217
......@@ -89,7 +89,7 @@ idl::Printer PrinterToIdl(
idl_printer.id = printer.id();
idl_printer.name = printer.display_name();
idl_printer.description = printer.description();
idl_printer.uri = printer.uri().GetNormalized();
idl_printer.uri = printer.uri().GetNormalized(true /*always_print_port*/);
idl_printer.source = PrinterSourceToIdl(printer.source());
idl_printer.is_default =
DoesPrinterMatchDefaultPrinterRules(printer, default_printer_rules);
......
......@@ -150,7 +150,7 @@ class PrinterConfigurerImpl : public PrinterConfigurer {
<< " Attempting autoconf setup";
auto* client = DBusThreadManager::Get()->GetDebugDaemonClient();
client->CupsAddAutoConfiguredPrinter(
printer.id(), printer.uri().GetNormalized(),
printer.id(), printer.uri().GetNormalized(true /*always_print_port*/),
base::BindOnce(&PrinterConfigurerImpl::OnAddedPrinter,
weak_factory_.GetWeakPtr(), printer,
std::move(callback)));
......@@ -180,7 +180,8 @@ class PrinterConfigurerImpl : public PrinterConfigurer {
PRINTER_LOG(EVENT) << printer.make_and_model() << " Manual printer setup";
client->CupsAddManuallyConfiguredPrinter(
printer.id(), printer.uri().GetNormalized(), ppd_contents,
printer.id(), printer.uri().GetNormalized(true /*always_print_port*/),
ppd_contents,
base::BindOnce(&PrinterConfigurerImpl::OnAddedPrinter,
weak_factory_.GetWeakPtr(), printer, std::move(cb)));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment