--- /dev/null
+/*
+tofuproxy -- HTTP proxy with TLS certificates management
+Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+package rounds
+
+import (
+ "fmt"
+ "net/http"
+
+ "go.stargrave.org/tofuproxy/fifos"
+)
+
+func RoundDenyFonts(
+ host string,
+ resp *http.Response,
+ w http.ResponseWriter,
+ req *http.Request,
+) (bool, error) {
+ switch resp.Header.Get("Content-Type") {
+ case "application/font-woff", "application/font-sfnt":
+ // Those are deprecated types
+ fallthrough
+ case "font/otf", "font/ttf", "font/woff", "font/woff2":
+ http.NotFound(w, req)
+ fifos.SinkOther <- fmt.Sprintf(
+ "%s %s\t%d\tdeny fonts",
+ req.Method,
+ req.URL.String(),
+ http.StatusNotFound,
+ )
+ resp.Body.Close()
+ return false, nil
+ }
+ return true, nil
+}