last-modified caching interferes with debug

This commit is contained in:
Ted Unangst 2019-04-11 10:05:37 -04:00
parent 53aa979d5b
commit 659d2b9ebc
2 changed files with 4 additions and 2 deletions

View File

@ -177,8 +177,10 @@ func homepage(w http.ResponseWriter, r *http.Request) {
if len(honks) > 0 { if len(honks) > 0 {
modtime = honks[0].Date modtime = honks[0].Date
} }
debug := false
getconfig("debug", &debug)
imh := r.Header.Get("If-Modified-Since") imh := r.Header.Get("If-Modified-Since")
if imh != "" && !modtime.IsZero() { if !debug && imh != "" && !modtime.IsZero() {
ifmod, err := time.Parse(http.TimeFormat, imh) ifmod, err := time.Parse(http.TimeFormat, imh)
if err == nil && !modtime.After(ifmod) { if err == nil && !modtime.After(ifmod) {
w.WriteHeader(http.StatusNotModified) w.WriteHeader(http.StatusNotModified)

View File

@ -2,7 +2,7 @@
<button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button> <button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button>
<form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" style="display: none"> <form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" style="display: none">
<p></p> <p></p>
<input type="hidden" name="rid" value=""> ly: <input type="text" name="rid" value="">
<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}"> <input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
<textarea name="noise" id="honknoise"></textarea> <textarea name="noise" id="honknoise"></textarea>
<p> <p>