- /* test preconditions */
- if(
- uh_file_if_modified_since(cl, req, &pi->stat) &&
- uh_file_if_match(cl, req, &pi->stat) &&
- uh_file_if_range(cl, req, &pi->stat) &&
- uh_file_if_unmodified_since(cl, req, &pi->stat) &&
- uh_file_if_none_match(cl, req, &pi->stat)
- ) {
- /* write status */
- uh_file_response_200(cl, req, &pi->stat);
-
- uh_http_sendf(cl, NULL, "Content-Type: %s\r\n", uh_file_mime_lookup(pi->name));
- uh_http_sendf(cl, NULL, "Content-Length: %i\r\n", pi->stat.st_size);
-
- /* if request was HTTP 1.1 we'll respond chunked */
- if( req->version > 1.0 )
- uh_http_send(cl, NULL, "Transfer-Encoding: chunked\r\n", -1);
-
- /* close header */
- uh_http_send(cl, NULL, "\r\n", -1);
+ /* write status */
+ uh_file_response_200(cl, req, &pi->stat);
+
+ uh_http_sendf(cl, NULL, "Content-Type: %s\r\n", uh_file_mime_lookup(pi->name));
+ uh_http_sendf(cl, NULL, "Content-Length: %i\r\n", pi->stat.st_size);
+
+ /* if request was HTTP 1.1 we'll respond chunked */
+ if( (req->version > 1.0) && (req->method != UH_HTTP_MSG_HEAD) )
+ uh_http_send(cl, NULL, "Transfer-Encoding: chunked\r\n", -1);