collectd/collectd — pull request #286 by shkitch (2013-03-27 10:35:27+00:00)
Title: curl_xml: URLs longer that 47 characters get truncated

Hello,

I noticed that the curl_xml plugin truncates its URLs after the 47th character. Given a set of URLs to collect the data from, for example:

http://www.hide.me/script/streaming/data/mobile/mobile-bigbang
http://www.hide.me/script/streaming/data/mobile/mobile-cufotv
http://www.hide.me/script/streaming/data/mobile/mobile-digiplus

... this appears in the collectd logfile:

[2013-03-08 11:26:43] [warning] The read function "curl_xml-stream-http://www.tvim.tv/script/streaming/data/mobile" is already registered. Check for duplicate "LoadPlugin" lines in your configuration!
[2013-03-08 11:26:43] [debug] curl_xml plugin: Registering new read callback: stream
[2013-03-08 11:26:43] [warning] The read function "curl_xml-stream-http://www.tvim.tv/script/streaming/data/mobile" is already registered. Check for duplicate "LoadPlugin" lines in your configuration!
[2013-03-08 11:26:43] [debug] curl_xml plugin: Registering new read callback: stream
[2013-03-08 11:26:43] [warning] The read function "curl_xml-stream-http://www.tvim.tv/script/streaming/data/mobile" is already registered. Check for duplicate "LoadPlugin" lines in your configuration!

I dug into the source and figured out that the name of the callback function gets constructed from the URL itself and then gets truncated to **DATA_MAX_NAME_LEN**. Since this is a show-stopper for my use case, I added some code to generate random strings and then constructed the callback name from these strings instead of the URL.

The patch is clumsy, but it works for me. PS: not sure about this but it might enable multiple fetches from the same URL too.