mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 15:40:50 +00:00
ignore the other compress method
This commit is contained in:
parent
3872c48349
commit
0bc70e88f0
@ -26,11 +26,6 @@ import (
|
|||||||
"gopkg.in/bufio.v1"
|
"gopkg.in/bufio.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type q struct {
|
|
||||||
name string
|
|
||||||
value float64
|
|
||||||
}
|
|
||||||
|
|
||||||
// WriteFile reads from file and writes to writer by the specific encoding(gzip/deflate)
|
// WriteFile reads from file and writes to writer by the specific encoding(gzip/deflate)
|
||||||
|
|
||||||
func WriteFile(encoding string, writer io.Writer, file *os.File) (bool, string, error) {
|
func WriteFile(encoding string, writer io.Writer, file *os.File) (bool, string, error) {
|
||||||
@ -55,6 +50,9 @@ func writeLevel(encoding string, writer io.Writer, reader io.Reader, level int)
|
|||||||
case "deflate":
|
case "deflate":
|
||||||
outputWriter, err = flate.NewWriter(writer, level)
|
outputWriter, err = flate.NewWriter(writer, level)
|
||||||
default:
|
default:
|
||||||
|
// all the other compress methods will ignore
|
||||||
|
// such as the deprecated compress and chrome-only sdch
|
||||||
|
encoding = ""
|
||||||
outputWriter = writer.(io.Writer)
|
outputWriter = writer.(io.Writer)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -81,6 +79,10 @@ func ParseEncoding(r *http.Request) string {
|
|||||||
return parseEncoding(r)
|
return parseEncoding(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type q struct {
|
||||||
|
name string
|
||||||
|
value float64
|
||||||
|
}
|
||||||
|
|
||||||
func parseEncoding(r *http.Request) string {
|
func parseEncoding(r *http.Request) string {
|
||||||
acceptEncoding := r.Header.Get("Accept-Encoding")
|
acceptEncoding := r.Header.Get("Accept-Encoding")
|
||||||
|
Loading…
Reference in New Issue
Block a user