Commit 0bc70e88 authored by JessonChan's avatar JessonChan

ignore the other compress method

parent 3872c483
...@@ -26,11 +26,6 @@ import ( ...@@ -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) ...@@ -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 { ...@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment