83 vfs_close(fd); |
83 vfs_close(fd); |
84 return NULL; |
84 return NULL; |
85 } |
85 } |
86 |
86 |
87 // sets last-modified, content-length and checks conditions |
87 // sets last-modified, content-length and checks conditions |
88 if(http_set_finfo(sn, rq, s) != REQ_PROCEED) { |
88 const char *etag = vfs_getetag(fd); // optionally, get etag from file |
|
89 if(http_set_finfo_etag(sn, rq, s, etag) != REQ_PROCEED) { |
89 vfs_close(fd); |
90 vfs_close(fd); |
90 return NULL; |
91 return NULL; |
91 } |
92 } |
92 |
93 |
93 // TODO: check if vfs can seek |
94 // TODO: check if vfs can seek |
635 int ret = REQ_NOACTION; |
636 int ret = REQ_NOACTION; |
636 if(single_range) { |
637 if(single_range) { |
637 // send response header |
638 // send response header |
638 http_start_response(sn, rq); |
639 http_start_response(sn, rq); |
639 // send content |
640 // send content |
640 // TODO: fix: send_range_aio is unstable |
641 // TODO: fix: send_range_aio is unstable #96 |
641 //ret = send_range_aio(sn, rq, fd, offset, length, NULL, 0); |
642 //ret = send_range_aio(sn, rq, fd, offset, length, NULL, 0); |
642 //if(ret == REQ_PROCESSING) { |
643 //if(ret == REQ_PROCESSING) { |
643 // return ret; |
644 // return ret; |
644 //} |
645 //} |
645 |
646 |