Commit c7083daf authored by Sean Kau's avatar Sean Kau Committed by Commit Bot

Fix url building for printer attribute queries.

We're building urls to make printer attribute requests to printers
directly to check for autoconf support and connectivity.  Ensure that
there is only one '/' between the authority and queue.

Bug: 819280
Change-Id: I0be201f46b344b807e121326f9bbf1d86565de32
Reviewed-on: https://chromium-review.googlesource.com/960939
Commit-Queue: Sean Kau <skau@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543465}
parent 1f84e158
...@@ -450,9 +450,15 @@ bool GetPrinterInfo(const std::string& address, ...@@ -450,9 +450,15 @@ bool GetPrinterInfo(const std::string& address,
return false; return false;
} }
// TODO(crbug.com/821497): Use a library to canonicalize the URL.
size_t first_non_slash = resource.find_first_not_of('/');
const std::string path = (first_non_slash == std::string::npos)
? ""
: resource.substr(first_non_slash);
std::string printer_uri = std::string printer_uri =
base::StringPrintf("%s://%s:%d/%s", encrypted ? kIppsScheme : kIppScheme, base::StringPrintf("%s://%s:%d/%s", encrypted ? kIppsScheme : kIppScheme,
address.c_str(), port, resource.c_str()); address.c_str(), port, path.c_str());
ipp_status_t status; ipp_status_t status;
ScopedIppPtr response = ScopedIppPtr response =
......
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