Commit 165cab7a authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpd: Support HEAD request

parent 5b59e46e
...@@ -1106,23 +1106,26 @@ void prepare_response(Stream *stream, Http2Handler *hd, ...@@ -1106,23 +1106,26 @@ void prepare_response(Stream *stream, Http2Handler *hd,
return; return;
} }
if (last_mod_found && static_cast<time_t>(buf.st_mtime) <= last_mod) { file_ent = sessions->cache_fd(
close(file); path, FileEntry(path, buf.st_size, buf.st_mtime, file));
}
stream->file_ent = file_ent;
if (last_mod_found && file_ent->mtime <= last_mod) {
hd->submit_response("304", stream->stream_id, nullptr); hd->submit_response("304", stream->stream_id, nullptr);
return; return;
} }
file_ent = sessions->cache_fd( auto &method = http2::get_header(stream->hdidx, http2::HD__METHOD,
path, FileEntry(path, buf.st_size, buf.st_mtime, file)); stream->headers)->value;
} else if (last_mod_found && file_ent->mtime <= last_mod) { if (method == "HEAD") {
sessions->release_fd(file_ent->path); hd->submit_file_response("200", stream, file_ent->mtime, file_ent->length,
hd->submit_response("304", stream->stream_id, nullptr); nullptr);
return; return;
} }
stream->file_ent = file_ent;
stream->body_length = file_ent->length; stream->body_length = file_ent->length;
nghttp2_data_provider data_prd; nghttp2_data_provider data_prd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment