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

Method compressGzip

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

Source from the content-addressed store, hash-verified

948}
949
950func (this *CaptchaValidator) compressGzip(writer http.ResponseWriter, htmlContent []byte) {
951 compressWriter, err := compressions.NewGzipWriter(writer, 0)
952 if err != nil {
953 writer.Header().Set("Content-Length", types.String(len(htmlContent)))
954 writer.WriteHeader(http.StatusOK)
955 _, _ = writer.Write(htmlContent)
956 return
957 }
958
959 writer.Header().Set("Content-Encoding", "gzip")
960 writer.WriteHeader(http.StatusOK)
961 _, _ = compressWriter.Write(htmlContent)
962 _ = compressWriter.Close()
963}
964
965func (this *CaptchaValidator) setCookie(writer http.ResponseWriter, setId int64, life int) {
966 if life < 1 {

Callers 1

compressWriteMethod · 0.95

Calls 8

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

Tested by

no test coverage detected