[HH] Deduplicated code.
[HH] Proper support for HEAD requests.
[HH] Handle ranges. Closes #1406.