[Bug debuginfod/28034] client-side %-escape url characters

Noah Sanci nsanci@redhat.com
Thu Sep 9 17:28:21 GMT 2021


Hello,

The attached patch %-escapes debuginfod url characters, then unescapes only
'/' characters. Previously characters such as '+' were not escaped and caused
improper escaping further on in handler_cb.
https://sourceware.org/bugzilla/show_bug.cgi?id=28034.

On Wed, Sep 8, 2021 at 9:38 AM Mark Wielaard <mark@klomp.org> wrote:
>   /* Initialize each handle.  */
>   for (int i = 0; i < num_urls; i++)
>
> So you only need to escape once. You of course then need to make sure
> the escaped_string is freed after the loop.
Added

> We already check that the first char is a '/'. It seems silly to curl
> escape that one and then unescape it again. So maybe curl_easy_escape
> (data[i].handle, filename + 1, 0) and then change the snprintf pattern
> to "%s/%s/%s/%s"?
>             ^ the slash got readded here.
Added

> The strlen inside the while loop can also be done outside and then
> calculated instead of running strlen on the tail every time.
Added

> Lastly I assume there are already testcases that cover this
> functionality? Just wanting to know how you tested it.
Previously, with run-debuginfod-find.sh the test was embedded within other
tests. Now the test is independent and has been added to the list of TESTS.

Regards,

Noah Sanci
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-debuginfod-PR28034-Percent-escape-debuginfod-urls.patch
Type: text/x-patch
Size: 7527 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/elfutils-devel/attachments/20210909/9e35b165/attachment-0001.bin>


More information about the Elfutils-devel mailing list