[squid-dev] [PATCH] implement RFC3986

Kinkie gkinkie at gmail.com
Mon Dec 28 14:01:06 UTC 2015


Hi,
  the attached patch is meant to implement rfc3986, and eventually
supersede rfc1738, which is not API-compatible with.

It implements two methods, templatized to be available to both SBuf
and std::string using the same implementation (called String
hereafter):

String rfc3986_unescape(const String &)
returns a new String () which percent-decodes the argument.

String rfc3986_escape(const String &, const CharacterSet&)
returns a new String which percent-encodes the first argument
according to the characters-to-be-escaped mask passed as second
argument (defaults to "unsafe and ctrls", which is defined the same as
in current rfc1738).

RFC3986 is a small auxiliary class meant to have a namespace-like
behavior for a bunch of constant CharacterSet which implement all
currently defined escape-masks, plus these in RFC 3986.

Unit tests have been adapted from rfc1738's and behavior matches
between the two implementations.

Unscientific performance testing (the code is in a disabled-by-default
unit test for those wishing to check the method) shows that the
rfc3986 implementation is faster than rfc1738's both in escaping and
unescaping by about 50%, except probably in the case where a fully
in-place unescaping is possible (this has not been tested).

This patch requires the SBuf API patch and the CharacterSet patch I
recently posted for review.

The feature-branch is at lp:~kinkie/squid/rfc3986

Thanks

-- 
    Francesco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rfc3986-v1.patch
Type: text/x-diff
Size: 14921 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20151228/917d737b/attachment-0001.patch>


More information about the squid-dev mailing list