rproxy: name the pages a refused visitor gets refusal pages

They were blockPages in blockpages.go. In this repo a block is the rule
action that answers 403 and bans nobody, while these pages answer every
refusal of 403 or 429, bans included. The docs already call them the
refusal pages.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-20 11:21:05 +00:00
1 parent b157359910
commit 354e10ea60
2 files changed
+8 -8

No files matched your search

@@ -20,17 +20,17 @@ const contactSentence = "contact the site's operator"
// htmlContentType is the Content-Type of the pages.
const htmlContentType = "text/html; charset=utf-8"
// blockPages are the pages a refused visitor gets, ready to send, made once
// refusalPages are the pages a refused visitor gets, ready to send, made once
// at start.
type blockPages struct {
type refusalPages struct {
refused []byte
rateLimited []byte
}
// newBlockPages makes the pages. With contactEmail set, each page's
// newRefusalPages makes the pages. With contactEmail set, each page's
// contactSentence is a mailto link to it.
func newBlockPages(contactEmail string) blockPages {
return blockPages{
func newRefusalPages(contactEmail string) refusalPages {
return refusalPages{
refused: readPage("refused.html", contactEmail),
rateLimited: readPage("ratelimited.html", contactEmail),
}
@@ -59,7 +59,7 @@ func readPage(name, contactEmail string) []byte {
// forStatus returns the page for a refusal with status, and whether there is
// one: the rate-limited page for a 429, the refused page for a 403.
func (p blockPages) forStatus(status int) ([]byte, bool) {
func (p refusalPages) forStatus(status int) ([]byte, bool) {
switch status {
case http.StatusForbidden:
return p.refused, true
+2 -2
View File
@@ -92,7 +92,7 @@ func New(params Params) *Server {
Path: wafprotocol.ReportPath,
}).String(),
breakerClock: time.Now,
pages: newBlockPages(params.Config.ContactEmail),
pages: newRefusalPages(params.Config.ContactEmail),
}
s := &Server{h: h}
@@ -158,7 +158,7 @@ type handler struct {
// reports are the goroutines sending reports to waf.
reports reportGoroutines
// pages are the pages a refused visitor gets.
pages blockPages
pages refusalPages
}
// newTransport returns what carries requests to the app. It never goes through