fix denials of service in msApplySLD() (#4703)

Avoid O(N^2) looping on supplied NamedLayers
Only allow HTTP and HTTPS for curl request
unlink temporary sld file in case of error
limit remote SLD downloads to 1 Megabyte by default, can be overriden by the
  (wms|ows)_remote_sld_max_bytes metadata entry