79 location[urilen+1] = '\0'; |
79 location[urilen+1] = '\0'; |
80 pblock_kvinsert(pb_key_location, location, urilen + 1, rq->srvhdrs); |
80 pblock_kvinsert(pb_key_location, location, urilen + 1, rq->srvhdrs); |
81 protocol_status(sn, rq, 302, NULL); |
81 protocol_status(sn, rq, 302, NULL); |
82 http_start_response(sn, rq); |
82 http_start_response(sn, rq); |
83 vfs_close(fd); |
83 vfs_close(fd); |
84 return fd; |
84 return NULL; |
85 } |
85 } |
86 |
86 |
87 // add content-length header |
87 // sets last-modified, content-length and checks conditions |
88 char contentLength[32]; |
88 if(http_set_finfo(sn, rq, s) != REQ_PROCEED) { |
89 int len = snprintf(contentLength, 32, "%jd", s->st_size); |
89 vfs_close(fd); |
90 |
90 return NULL; |
91 pblock_kvinsert(pb_key_content_length, contentLength, len, rq->srvhdrs); |
91 } |
92 |
92 |
93 // start response |
93 // start response |
94 protocol_status(sn, rq, 200, NULL); |
94 protocol_status(sn, rq, 200, NULL); |
95 http_start_response(sn, rq); |
95 http_start_response(sn, rq); |
96 |
96 |