MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / compressBR

Method compressBR

internal/waf/captcha_validator.go:935–948  ·  view source on GitHub ↗
(writer http.ResponseWriter, htmlContent []byte)

Source from the content-addressed store, hash-verified

933}
934
935func (this *CaptchaValidator) compressBR(writer http.ResponseWriter, htmlContent []byte) {
936 compressWriter, err := compressions.NewBrotliWriter(writer, 0)
937 if err != nil {
938 writer.Header().Set("Content-Length", types.String(len(htmlContent)))
939 writer.WriteHeader(http.StatusOK)
940 _, _ = writer.Write(htmlContent)
941 return
942 }
943
944 writer.Header().Set("Content-Encoding", "br")
945 writer.WriteHeader(http.StatusOK)
946 _, _ = compressWriter.Write(htmlContent)
947 _ = compressWriter.Close()
948}
949
950func (this *CaptchaValidator) compressGzip(writer http.ResponseWriter, htmlContent []byte) {
951 compressWriter, err := compressions.NewGzipWriter(writer, 0)

Callers 1

compressWriteMethod · 0.95

Calls 8

WriteMethod · 0.95
CloseMethod · 0.95
NewBrotliWriterFunction · 0.92
WriteHeaderMethod · 0.65
WriteMethod · 0.65
SetMethod · 0.45
HeaderMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected