+htp #15930 import RangeDirectives from spray

Based on a rebased version of #16183. So, just review the last commit. I will rebase once the other PR is merged.

Fixes #15930.

/cc @sirthias
Thanks, makes sense. I moved the comment from above to here and left a note to look here for the explanation of the behavior.