fixed range requests, tests improved

@cebe i've fixed some errors and made some improvements, also added tests.
Related with this issue https://github.com/yiisoft/yii2/issues/286.