630 } else { |
630 } else { |
631 offset = 0; |
631 offset = 0; |
632 length = s.st_size; |
632 length = s.st_size; |
633 } |
633 } |
634 |
634 |
|
635 int ret = REQ_NOACTION; |
635 if(single_range) { |
636 if(single_range) { |
636 // send response header |
637 // send response header |
637 http_start_response(sn, rq); |
638 http_start_response(sn, rq); |
638 // send content |
639 // send content |
639 int ret = send_range_aio(sn, rq, fd, offset, length, NULL, 0); |
640 ret = send_range_aio(sn, rq, fd, offset, length, NULL, 0); |
640 if(ret == REQ_PROCESSING) { |
641 if(ret == REQ_PROCESSING) { |
641 return ret; |
642 return ret; |
642 } |
643 } |
643 /* |
644 /* |
644 if(send_range(sn, fd, offset, length, NULL, 0)) { |
645 if(send_range(sn, fd, offset, length, NULL, 0)) { |
645 // TODO: error |
646 // TODO: error |
646 } |
647 } |
647 //*/ |
648 //*/ |
648 } else { |
649 } else { |
649 if(send_multi_range(sn, rq, fd, s.st_size, range)) { |
650 ret = send_multi_range(sn, rq, fd, s.st_size, range); |
650 // TODO: error |
651 // TODO: error |
651 } |
|
652 } |
652 } |
653 |
653 |
654 // cleanup |
654 // cleanup |
655 vfs_close(fd); |
655 vfs_close(fd); |
656 free_range(sn, range); |
656 free_range(sn, range); |
657 |
657 |
658 return REQ_PROCEED; |
658 return ret; |
659 } |
659 } |
660 |
660 |
661 |
661 |
662 |
662 |
663 int service_hello(pblock *pb, Session *sn, Request *rq) { |
663 int service_hello(pblock *pb, Session *sn, Request *rq) { |