BUG/MEDIUM: http-conv: Fix url_enc() to not crush const samples

url_enc() encodes an input string by calling encode_string(). To do so, it
adds a trailing '\0' to the sample string. However it never restores the
sample string at the end. It is a problem for const samples. The sample
string may be in the middle of a buffer. For instance, the HTTP headers
values are concerned.

However, instead of modifying the sample string, it is easier to rely on
encode_chunk() function. It does the same but on a buffer.

This patch must be backported as far as 2.2.

(cherry picked from commit 21ac0eec280685174fbe368c4da0cb9cb8efd075)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit df968906e9718a0fe0e173d69988bd8d0374464e)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed