]> git.ipfire.org Git - thirdparty/squid.git/commit - src/neighbors.cc
Bug 1961 extra: Convert the URL::parse method API to take const URI strings
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 9 Jul 2017 08:16:33 +0000 (20:16 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 9 Jul 2017 08:16:33 +0000 (20:16 +1200)
commit8babada05a107f0755510e6b40cdde309fb48008
tree5c147a2a71467ee67bf29d9c54f6a5cb5ad19e9f
parent98d0df032f1241f1b202c46a02bf3b7521e5f859
Bug 1961 extra: Convert the URL::parse method API to take const URI strings

The input buffer is no longer truncated when overly long. All callers have
been checked that they handle the bool false return value in ways that do
not rely on that truncation.

Callers that were making non-const copies of buffers specifically for the
parsing stage are altered not to do so. This allows a few data copies and
allocations to be removed entirely, or delayed to remove from error handling
paths.

While checking all the callers of Http::FromUrl several places were found to
be using the "raw" URL string before the parsing and validation was done. The
simplest in src/mime.cc is already applied to v5 r15234. A more complicated
redesign in src/store_digest.cc is included here for review. One other marked
with an "XXX: polluting ..." note.

Also, added several TODO's to mark code where class URL needs to be used when
the parser is a bit more efficient.

Also, removed a leftover definition of already removed urlParse() function.
17 files changed:
src/Downloader.cc
src/HttpRequest.cc
src/HttpRequest.h
src/URL.h
src/acl/Asn.cc
src/adaptation/ecap/MessageRep.cc
src/client_side_request.cc
src/mgr/Inquirer.cc
src/neighbors.cc
src/redirect.cc
src/servers/FtpServer.cc
src/servers/Http1Server.cc
src/store_digest.cc
src/tests/stub_HttpRequest.cc
src/tests/stub_url.cc
src/url.cc
src/urn.cc