Improved range-related code

Created a function that obtains the range from the header and extracted the
regex to compile it only once.
The Accept-Ranges headers is added always

Not only when partial content is requested